|
53 | 53 | import org.springframework.security.web.util.matcher.RequestMatcher;
|
54 | 54 | import org.springframework.util.Assert;
|
55 | 55 |
|
56 |
| -import static org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2ConfigurerUtils.withMultipleIssuerPattern; |
| 56 | +import static org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2ConfigurerUtils.withMultipleIssuersPattern; |
57 | 57 |
|
58 | 58 | /**
|
59 | 59 | * Configurer for OAuth 2.0 Client Authentication.
|
@@ -163,19 +163,23 @@ public OAuth2ClientAuthenticationConfigurer errorResponseHandler(AuthenticationF
|
163 | 163 | @Override
|
164 | 164 | void init(HttpSecurity httpSecurity) {
|
165 | 165 | AuthorizationServerSettings authorizationServerSettings = OAuth2ConfigurerUtils.getAuthorizationServerSettings(httpSecurity);
|
| 166 | + String tokenEndpointUri = authorizationServerSettings.isMultipleIssuersAllowed() ? |
| 167 | + withMultipleIssuersPattern(authorizationServerSettings.getTokenEndpoint()) : |
| 168 | + authorizationServerSettings.getTokenEndpoint(); |
| 169 | + String tokenIntrospectionEndpointUri = authorizationServerSettings.isMultipleIssuersAllowed() ? |
| 170 | + withMultipleIssuersPattern(authorizationServerSettings.getTokenIntrospectionEndpoint()) : |
| 171 | + authorizationServerSettings.getTokenIntrospectionEndpoint(); |
| 172 | + String tokenRevocationEndpointUri = authorizationServerSettings.isMultipleIssuersAllowed() ? |
| 173 | + withMultipleIssuersPattern(authorizationServerSettings.getTokenRevocationEndpoint()) : |
| 174 | + authorizationServerSettings.getTokenRevocationEndpoint(); |
| 175 | + String deviceAuthorizationEndpointUri = authorizationServerSettings.isMultipleIssuersAllowed() ? |
| 176 | + withMultipleIssuersPattern(authorizationServerSettings.getDeviceAuthorizationEndpoint()) : |
| 177 | + authorizationServerSettings.getDeviceAuthorizationEndpoint(); |
166 | 178 | this.requestMatcher = new OrRequestMatcher(
|
167 |
| - new AntPathRequestMatcher( |
168 |
| - withMultipleIssuerPattern(authorizationServerSettings.getTokenEndpoint()), |
169 |
| - HttpMethod.POST.name()), |
170 |
| - new AntPathRequestMatcher( |
171 |
| - withMultipleIssuerPattern(authorizationServerSettings.getTokenIntrospectionEndpoint()), |
172 |
| - HttpMethod.POST.name()), |
173 |
| - new AntPathRequestMatcher( |
174 |
| - withMultipleIssuerPattern(authorizationServerSettings.getTokenRevocationEndpoint()), |
175 |
| - HttpMethod.POST.name()), |
176 |
| - new AntPathRequestMatcher( |
177 |
| - withMultipleIssuerPattern(authorizationServerSettings.getDeviceAuthorizationEndpoint()), |
178 |
| - HttpMethod.POST.name())); |
| 179 | + new AntPathRequestMatcher(tokenEndpointUri, HttpMethod.POST.name()), |
| 180 | + new AntPathRequestMatcher(tokenIntrospectionEndpointUri, HttpMethod.POST.name()), |
| 181 | + new AntPathRequestMatcher(tokenRevocationEndpointUri, HttpMethod.POST.name()), |
| 182 | + new AntPathRequestMatcher(deviceAuthorizationEndpointUri, HttpMethod.POST.name())); |
179 | 183 |
|
180 | 184 | List<AuthenticationProvider> authenticationProviders = createDefaultAuthenticationProviders(httpSecurity);
|
181 | 185 | if (!this.authenticationProviders.isEmpty()) {
|
|
0 commit comments