Skip to content

Commit 37b8d01

Browse files
committed
Polish RequestMatcher Migration Path for OAuth 2.0 Login DSL
Issue gh-16573
1 parent 9934553 commit 37b8d01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ public OAuth2LoginConfigurer<B> userInfoEndpoint(Customizer<UserInfoEndpointConf
351351
public void init(B http) throws Exception {
352352
OAuth2LoginAuthenticationFilter authenticationFilter = new OAuth2LoginAuthenticationFilter(
353353
this.getClientRegistrationRepository(), this.getAuthorizedClientRepository(), this.loginProcessingUrl);
354+
RequestMatcher processUri = RequestMatcherFactory.matcher(this.loginProcessingUrl);
355+
authenticationFilter.setRequiresAuthenticationRequestMatcher(processUri);
354356
authenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy());
355357
this.setAuthenticationFilter(authenticationFilter);
356358
super.loginProcessingUrl(this.loginProcessingUrl);
@@ -434,7 +436,8 @@ public void configure(B http) throws Exception {
434436
http.addFilter(this.postProcess(authorizationRequestFilter));
435437
OAuth2LoginAuthenticationFilter authenticationFilter = this.getAuthenticationFilter();
436438
if (this.redirectionEndpointConfig.authorizationResponseBaseUri != null) {
437-
authenticationFilter.setFilterProcessesUrl(this.redirectionEndpointConfig.authorizationResponseBaseUri);
439+
authenticationFilter.setRequiresAuthenticationRequestMatcher(
440+
RequestMatcherFactory.matcher(this.redirectionEndpointConfig.authorizationResponseBaseUri));
438441
}
439442
if (this.authorizationEndpointConfig.authorizationRequestRepository != null) {
440443
authenticationFilter

0 commit comments

Comments
 (0)