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
3cc441c8
Commit
3cc441c8
authored
Dec 11, 2018
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not remove trailing slash from OAuth2 Issuer URI
Fixes gh-15324
parent
d05ae40c
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 @
3cc441c8
...
...
@@ -86,9 +86,7 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
Provider
provider
=
providers
.
get
(
providerId
);
String
issuer
=
provider
.
getIssuerUri
();
if
(
issuer
!=
null
)
{
String
cleanedIssuer
=
cleanIssuerPath
(
issuer
);
Builder
builder
=
ClientRegistrations
.
fromOidcIssuerLocation
(
cleanedIssuer
)
Builder
builder
=
ClientRegistrations
.
fromOidcIssuerLocation
(
issuer
)
.
registrationId
(
registrationId
);
return
getBuilder
(
builder
,
provider
);
}
...
...
@@ -96,13 +94,6 @@ public final class OAuth2ClientPropertiesRegistrationAdapter {
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
,
Map
<
String
,
Provider
>
providers
)
{
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 @
3cc441c8
...
...
@@ -269,8 +269,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
this
.
server
=
new
MockWebServer
();
this
.
server
.
start
();
String
issuer
=
this
.
server
.
url
(
""
).
toString
();
String
cleanIssuerPath
=
cleanIssuerPath
(
issuer
);
setupMockResponse
(
cleanIssuerPath
);
setupMockResponse
(
issuer
);
OAuth2ClientProperties
.
Registration
registration
=
new
OAuth2ClientProperties
.
Registration
();
registration
.
setProvider
(
"okta-oidc"
);
registration
.
setClientId
(
"clientId"
);
...
...
@@ -297,7 +296,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat
(
adapted
.
getAuthorizationGrantType
())
.
isEqualTo
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
);
assertThat
(
adapted
.
getRegistrationId
()).
isEqualTo
(
"okta"
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
cleanIssuerPath
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
issuer
);
assertThat
(
adapted
.
getScopes
()).
containsOnly
(
"user"
);
assertThat
(
adapted
.
getRedirectUriTemplate
())
.
isEqualTo
(
"http://example.com/redirect"
);
...
...
@@ -316,8 +315,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
this
.
server
=
new
MockWebServer
();
this
.
server
.
start
();
String
issuer
=
this
.
server
.
url
(
""
).
toString
();
String
cleanIssuerPath
=
cleanIssuerPath
(
issuer
);
setupMockResponse
(
cleanIssuerPath
);
setupMockResponse
(
issuer
);
OAuth2ClientProperties
properties
=
new
OAuth2ClientProperties
();
Provider
provider
=
new
Provider
();
provider
.
setIssuerUri
(
issuer
);
...
...
@@ -332,7 +330,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
assertThat
(
adapted
.
getAuthorizationGrantType
())
.
isEqualTo
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
);
assertThat
(
adapted
.
getRegistrationId
()).
isEqualTo
(
"okta"
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
cleanIssuerPath
);
assertThat
(
adapted
.
getClientName
()).
isEqualTo
(
issuer
);
assertThat
(
adapted
.
getScopes
()).
containsOnly
(
"openid"
);
assertThat
(
providerDetails
.
getAuthorizationUri
())
.
isEqualTo
(
"https://example.com/o/oauth2/v2/auth"
);
...
...
spring-boot-samples/spring-boot-sample-oauth2-client/src/main/resources/application.yml
View file @
3cc441c8
...
...
@@ -29,4 +29,4 @@ spring:
client-name
:
GitHub Repositories
provider
:
yahoo-oidc
:
issuer-uri
:
https://api.login.yahoo.com/
\ No newline at end of file
issuer-uri
:
https://api.login.yahoo.com
\ No newline at end of file
spring-boot-samples/spring-boot-sample-reactive-oauth2-client/src/main/resources/application.yml
View file @
3cc441c8
...
...
@@ -22,4 +22,4 @@ spring:
client-secret
:
${YAHOO-CLIENT-SECRET}
provider
:
yahoo-oidc
:
issuer-uri
:
https://api.login.yahoo.com/
\ No newline at end of file
issuer-uri
:
https://api.login.yahoo.com
\ 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