ClientRegistration supports 'baseUrl' uri variable
Fixes gh-4589
This commit is contained in:
parent
dec0bce100
commit
eca2b67137
|
@ -160,14 +160,14 @@ public class AuthorizationCodeRequestRedirectFilter extends OncePerRequestFilter
|
|||
uriVariables.put("contextPath", request.getContextPath());
|
||||
uriVariables.put("registrationId", clientRegistration.getRegistrationId());
|
||||
|
||||
String baseRedirectUrl = UriComponentsBuilder.newInstance()
|
||||
String baseUrl = UriComponentsBuilder.newInstance()
|
||||
.scheme(request.getScheme())
|
||||
.host(request.getServerName())
|
||||
.port(request.getServerPort())
|
||||
.path(request.getContextPath())
|
||||
.build()
|
||||
.toUriString();
|
||||
uriVariables.put("baseRedirectUrl", baseRedirectUrl);
|
||||
uriVariables.put("baseUrl", baseUrl);
|
||||
|
||||
return UriComponentsBuilder.fromUriString(clientRegistration.getRedirectUri())
|
||||
.buildAndExpand(uriVariables)
|
||||
|
|
|
@ -5,7 +5,7 @@ security:
|
|||
google:
|
||||
client-authentication-method: basic
|
||||
authorization-grant-type: authorization_code
|
||||
redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{registrationId}"
|
||||
redirect-uri: "{baseUrl}/oauth2/authorize/code/{registrationId}"
|
||||
scope: openid, profile, email, address, phone
|
||||
authorization-uri: "https://accounts.google.com/o/oauth2/v2/auth"
|
||||
token-uri: "https://www.googleapis.com/oauth2/v4/token"
|
||||
|
@ -16,7 +16,7 @@ security:
|
|||
github:
|
||||
client-authentication-method: basic
|
||||
authorization-grant-type: authorization_code
|
||||
redirect-uri: "{baseRedirectUrl}/oauth2/authorize/code/{registrationId}"
|
||||
redirect-uri: "{baseUrl}/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