Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f863ce32
Commit
f863ce32
authored
Dec 11, 2018
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x'
parents
55d7c19c
3cc441c8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
18 deletions
+7
-18
OAuth2ClientPropertiesRegistrationAdapter.java
...th2/client/OAuth2ClientPropertiesRegistrationAdapter.java
+1
-10
OAuth2ClientPropertiesRegistrationAdapterTests.java
...lient/OAuth2ClientPropertiesRegistrationAdapterTests.java
+4
-6
application.yml
...t-sample-oauth2-client/src/main/resources/application.yml
+1
-1
application.yml
...reactive-oauth2-client/src/main/resources/application.yml
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java
View file @
f863ce32
...
@@ -85,9 +85,7 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
...
@@ -85,9 +85,7 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
Provider
provider
=
providers
.
get
(
providerId
);
Provider
provider
=
providers
.
get
(
providerId
);
String
issuer
=
provider
.
getIssuerUri
();
String
issuer
=
provider
.
getIssuerUri
();
if
(
issuer
!=
null
)
{
if
(
issuer
!=
null
)
{
String
cleanedIssuer
=
cleanIssuerPath
(
issuer
);
Builder
builder
=
ClientRegistrations
.
fromOidcIssuerLocation
(
issuer
)
Builder
builder
=
ClientRegistrations
.
fromOidcIssuerLocation
(
cleanedIssuer
)
.
registrationId
(
registrationId
);
.
registrationId
(
registrationId
);
return
getBuilder
(
builder
,
provider
);
return
getBuilder
(
builder
,
provider
);
}
}
...
@@ -95,13 +93,6 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
...
@@ -95,13 +93,6 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
return
null
;
return
null
;
}
}
private
static
String
cleanIssuerPath
(
String
issuer
)
{
if
(
issuer
.
endsWith
(
"/"
))
{
return
issuer
.
substring
(
0
,
issuer
.
length
()
-
1
);
}
return
issuer
;
}
private
static
Builder
getBuilder
(
String
registrationId
,
String
configuredProviderId
,
private
static
Builder
getBuilder
(
String
registrationId
,
String
configuredProviderId
,
Map
<
String
,
Provider
>
providers
)
{
Map
<
String
,
Provider
>
providers
)
{
String
providerId
=
(
configuredProviderId
!=
null
)
?
configuredProviderId
String
providerId
=
(
configuredProviderId
!=
null
)
?
configuredProviderId
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapterTests.java
View file @
f863ce32
...
@@ -269,8 +269,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
...
@@ -269,8 +269,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
this
.
server
=
new
MockWebServer
();
this
.
server
=
new
MockWebServer
();
this
.
server
.
start
();
this
.
server
.
start
();
String
issuer
=
this
.
server
.
url
(
""
).
toString
();
String
issuer
=
this
.
server
.
url
(
""
).
toString
();
String
cleanIssuerPath
=
cleanIssuerPath
(
issuer
);
setupMockResponse
(
issuer
);
setupMockResponse
(
cleanIssuerPath
);
OAuth2ClientProperties
.
Registration
registration
=
new
OAuth2ClientProperties
.
Registration
();
OAuth2ClientProperties
.
Registration
registration
=
new
OAuth2ClientProperties
.
Registration
();
registration
.
setProvider
(
"okta-oidc"
);
registration
.
setProvider
(
"okta-oidc"
);
registration
.
setClientId
(
"clientId"
);
registration
.
setClientId
(
"clientId"
);
...
@@ -297,7 +296,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
...
@@ -297,7 +296,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat
(
adapted
.
getAuthorizationGrantType
())
assertThat
(
adapted
.
getAuthorizationGrantType
())
.
isEqualTo
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
);
.
isEqualTo
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
);
assertThat
(
adapted
.
getRegistrationId
()).
isEqualTo
(
"okta"
);
assertThat
(
adapted
.
getRegistrationId
()).
isEqualTo
(
"okta"
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
cleanIssuerPath
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
issuer
);
assertThat
(
adapted
.
getScopes
()).
containsOnly
(
"user"
);
assertThat
(
adapted
.
getScopes
()).
containsOnly
(
"user"
);
assertThat
(
adapted
.
getRedirectUriTemplate
())
assertThat
(
adapted
.
getRedirectUriTemplate
())
.
isEqualTo
(
"http://example.com/redirect"
);
.
isEqualTo
(
"http://example.com/redirect"
);
...
@@ -316,8 +315,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
...
@@ -316,8 +315,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
this
.
server
=
new
MockWebServer
();
this
.
server
=
new
MockWebServer
();
this
.
server
.
start
();
this
.
server
.
start
();
String
issuer
=
this
.
server
.
url
(
""
).
toString
();
String
issuer
=
this
.
server
.
url
(
""
).
toString
();
String
cleanIssuerPath
=
cleanIssuerPath
(
issuer
);
setupMockResponse
(
issuer
);
setupMockResponse
(
cleanIssuerPath
);
OAuth2ClientProperties
properties
=
new
OAuth2ClientProperties
();
OAuth2ClientProperties
properties
=
new
OAuth2ClientProperties
();
Provider
provider
=
new
Provider
();
Provider
provider
=
new
Provider
();
provider
.
setIssuerUri
(
issuer
);
provider
.
setIssuerUri
(
issuer
);
...
@@ -332,7 +330,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
...
@@ -332,7 +330,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat
(
adapted
.
getAuthorizationGrantType
())
assertThat
(
adapted
.
getAuthorizationGrantType
())
.
isEqualTo
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
);
.
isEqualTo
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
);
assertThat
(
adapted
.
getRegistrationId
()).
isEqualTo
(
"okta"
);
assertThat
(
adapted
.
getRegistrationId
()).
isEqualTo
(
"okta"
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
cleanIssuerPath
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
issuer
);
assertThat
(
adapted
.
getScopes
()).
containsOnly
(
"openid"
);
assertThat
(
adapted
.
getScopes
()).
containsOnly
(
"openid"
);
assertThat
(
providerDetails
.
getAuthorizationUri
())
assertThat
(
providerDetails
.
getAuthorizationUri
())
.
isEqualTo
(
"https://example.com/o/oauth2/v2/auth"
);
.
isEqualTo
(
"https://example.com/o/oauth2/v2/auth"
);
...
...
spring-boot-samples/spring-boot-sample-oauth2-client/src/main/resources/application.yml
View file @
f863ce32
...
@@ -29,4 +29,4 @@ spring:
...
@@ -29,4 +29,4 @@ spring:
client-name
:
GitHub Repositories
client-name
:
GitHub Repositories
provider
:
provider
:
yahoo-oidc
:
yahoo-oidc
:
issuer-uri
:
https://api.login.yahoo.com/
issuer-uri
:
https://api.login.yahoo.com
\ No newline at end of file
\ No newline at end of file
spring-boot-samples/spring-boot-sample-reactive-oauth2-client/src/main/resources/application.yml
View file @
f863ce32
...
@@ -22,4 +22,4 @@ spring:
...
@@ -22,4 +22,4 @@ spring:
client-secret
:
${YAHOO-CLIENT-SECRET}
client-secret
:
${YAHOO-CLIENT-SECRET}
provider
:
provider
:
yahoo-oidc
:
yahoo-oidc
:
issuer-uri
:
https://api.login.yahoo.com/
issuer-uri
:
https://api.login.yahoo.com
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment