mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-06 02:32:14 +00:00
Add context path to authorization request URI
Fixes gh-4510
This commit is contained in:
parent
ec908bb700
commit
4951550d7d
@ -151,6 +151,7 @@ public class AuthorizationCodeRequestRedirectFilter extends OncePerRequestFilter
|
|||||||
uriVariables.put("scheme", request.getScheme());
|
uriVariables.put("scheme", request.getScheme());
|
||||||
uriVariables.put("serverName", request.getServerName());
|
uriVariables.put("serverName", request.getServerName());
|
||||||
uriVariables.put("serverPort", String.valueOf(request.getServerPort()));
|
uriVariables.put("serverPort", String.valueOf(request.getServerPort()));
|
||||||
|
uriVariables.put("contextPath", request.getContextPath());
|
||||||
uriVariables.put("clientAlias", clientRegistration.getClientAlias());
|
uriVariables.put("clientAlias", clientRegistration.getClientAlias());
|
||||||
|
|
||||||
return UriComponentsBuilder.fromUriString(clientRegistration.getRedirectUri())
|
return UriComponentsBuilder.fromUriString(clientRegistration.getRedirectUri())
|
||||||
|
@ -4,7 +4,7 @@ security:
|
|||||||
google:
|
google:
|
||||||
client-authentication-method: basic
|
client-authentication-method: basic
|
||||||
authorized-grant-type: authorization_code
|
authorized-grant-type: authorization_code
|
||||||
redirect-uri: "{scheme}://{serverName}:{serverPort}/oauth2/authorize/code/{clientAlias}"
|
redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{clientAlias}"
|
||||||
scopes: openid, profile, email, address, phone
|
scopes: openid, profile, email, address, phone
|
||||||
authorization-uri: "https://accounts.google.com/o/oauth2/auth"
|
authorization-uri: "https://accounts.google.com/o/oauth2/auth"
|
||||||
token-uri: "https://accounts.google.com/o/oauth2/token"
|
token-uri: "https://accounts.google.com/o/oauth2/token"
|
||||||
@ -15,7 +15,7 @@ security:
|
|||||||
github:
|
github:
|
||||||
client-authentication-method: basic
|
client-authentication-method: basic
|
||||||
authorized-grant-type: authorization_code
|
authorized-grant-type: authorization_code
|
||||||
redirect-uri: "{scheme}://{serverName}:{serverPort}/oauth2/authorize/code/{clientAlias}"
|
redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{clientAlias}"
|
||||||
scopes: user
|
scopes: user
|
||||||
authorization-uri: "https://github.com/login/oauth/authorize"
|
authorization-uri: "https://github.com/login/oauth/authorize"
|
||||||
token-uri: "https://github.com/login/oauth/access_token"
|
token-uri: "https://github.com/login/oauth/access_token"
|
||||||
@ -26,7 +26,7 @@ security:
|
|||||||
facebook:
|
facebook:
|
||||||
client-authentication-method: post
|
client-authentication-method: post
|
||||||
authorized-grant-type: authorization_code
|
authorized-grant-type: authorization_code
|
||||||
redirect-uri: "{scheme}://{serverName}:{serverPort}/oauth2/authorize/code/{clientAlias}"
|
redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{clientAlias}"
|
||||||
scopes: public_profile, email
|
scopes: public_profile, email
|
||||||
authorization-uri: "https://www.facebook.com/v2.8/dialog/oauth"
|
authorization-uri: "https://www.facebook.com/v2.8/dialog/oauth"
|
||||||
token-uri: "https://graph.facebook.com/v2.8/oauth/access_token"
|
token-uri: "https://graph.facebook.com/v2.8/oauth/access_token"
|
||||||
@ -37,7 +37,7 @@ security:
|
|||||||
okta:
|
okta:
|
||||||
client-authentication-method: basic
|
client-authentication-method: basic
|
||||||
authorized-grant-type: authorization_code
|
authorized-grant-type: authorization_code
|
||||||
redirect-uri: "{scheme}://{serverName}:{serverPort}/oauth2/authorize/code/{clientAlias}"
|
redirect-uri: "{scheme}://{serverName}:{serverPort}{contextPath}/oauth2/authorize/code/{clientAlias}"
|
||||||
scopes: openid, profile, email, address, phone
|
scopes: openid, profile, email, address, phone
|
||||||
client-name: Okta
|
client-name: Okta
|
||||||
client-alias: okta
|
client-alias: okta
|
||||||
|
@ -268,7 +268,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
|
|||||||
sb.append("<table>\n");
|
sb.append("<table>\n");
|
||||||
for (Map.Entry<String, String> clientAuthenticationUrlToClientName : oauth2AuthenticationUrlToClientName.entrySet()) {
|
for (Map.Entry<String, String> clientAuthenticationUrlToClientName : oauth2AuthenticationUrlToClientName.entrySet()) {
|
||||||
sb.append(" <tr><td>");
|
sb.append(" <tr><td>");
|
||||||
sb.append("<a href=\"").append(clientAuthenticationUrlToClientName.getKey()).append("\">");
|
sb.append("<a href=\"").append(request.getContextPath()).append(clientAuthenticationUrlToClientName.getKey()).append("\">");
|
||||||
sb.append(clientAuthenticationUrlToClientName.getValue());
|
sb.append(clientAuthenticationUrlToClientName.getValue());
|
||||||
sb.append("</a>");
|
sb.append("</a>");
|
||||||
sb.append("</td></tr>\n");
|
sb.append("</td></tr>\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user