redirect-uri property supports 'baseRedirectUrl' uri variable
Fixes gh-4589
This commit is contained in:
parent
66647070ab
commit
fb57111ecd
|
@ -13,7 +13,7 @@ spring.security.oauth2.client.templates.google.client-alias=google
|
|||
# GitHub
|
||||
spring.security.oauth2.client.templates.github.client-authentication-method=basic
|
||||
spring.security.oauth2.client.templates.github.authorization-grant-type=authorization_code
|
||||
spring.security.oauth2.client.templates.github.redirect-uri={scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{registrationId}
|
||||
spring.security.oauth2.client.templates.github.redirect-uri={baseRedirectUrl}/oauth2/authorize/code/{registrationId}
|
||||
spring.security.oauth2.client.templates.github.scope=user
|
||||
spring.security.oauth2.client.templates.github.authorization-uri=https://github.com/login/oauth/authorize
|
||||
spring.security.oauth2.client.templates.github.token-uri=https://github.com/login/oauth/access_token
|
||||
|
|
|
@ -160,6 +160,15 @@ public class AuthorizationCodeRequestRedirectFilter extends OncePerRequestFilter
|
|||
uriVariables.put("contextPath", request.getContextPath());
|
||||
uriVariables.put("registrationId", clientRegistration.getRegistrationId());
|
||||
|
||||
String baseRedirectUrl = UriComponentsBuilder.newInstance()
|
||||
.scheme(request.getScheme())
|
||||
.host(request.getServerName())
|
||||
.port(request.getServerPort())
|
||||
.path(request.getContextPath())
|
||||
.build()
|
||||
.toUriString();
|
||||
uriVariables.put("baseRedirectUrl", baseRedirectUrl);
|
||||
|
||||
return UriComponentsBuilder.fromUriString(clientRegistration.getRedirectUri())
|
||||
.buildAndExpand(uriVariables)
|
||||
.toUriString();
|
||||
|
|
|
@ -15,7 +15,7 @@ security:
|
|||
github:
|
||||
client-authentication-method: basic
|
||||
authorization-grant-type: authorization_code
|
||||
redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{registrationId}"
|
||||
redirect-uri: "{baseRedirectUrl}/oauth2/authorize/code/{registrationId}"
|
||||
scope: user
|
||||
authorization-uri: "https://github.com/login/oauth/authorize"
|
||||
token-uri: "https://github.com/login/oauth/access_token"
|
||||
|
|
Loading…
Reference in New Issue