Skip to content

Commit 6e76df8

Browse files
committed
Revert OAuth2AuthorizationCodeGrantWebFilter works with /{action}/
Issue #5856 Commit 385bdfc NOTE: This commit 'partially' reverts #5856. Only the ServerWebExchangeMatcher for OAuth2LoginSpec is reverted. Fixes gh-6890
1 parent 06943d2 commit 6e76df8

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

config/src/main/java/org/springframework/security/config/web/server/ServerHttpSecurity.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import org.springframework.security.core.AuthenticationException;
5757
import org.springframework.security.core.GrantedAuthority;
5858
import org.springframework.security.core.authority.AuthorityUtils;
59-
import org.springframework.security.core.context.ReactiveSecurityContextHolder;
6059
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
6160
import org.springframework.security.oauth2.client.InMemoryReactiveOAuth2AuthorizedClientService;
6261
import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientService;
@@ -866,11 +865,7 @@ public Mono<Void> onAuthenticationFailure(WebFilterExchange webFilterExchange,
866865
}
867866

868867
private ServerWebExchangeMatcher createAttemptAuthenticationRequestMatcher() {
869-
PathPatternParserServerWebExchangeMatcher loginPathMatcher = new PathPatternParserServerWebExchangeMatcher("/login/oauth2/code/{registrationId}");
870-
ServerWebExchangeMatcher notAuthenticatedMatcher = e -> ReactiveSecurityContextHolder.getContext()
871-
.flatMap(p -> ServerWebExchangeMatcher.MatchResult.notMatch())
872-
.switchIfEmpty(ServerWebExchangeMatcher.MatchResult.match());
873-
return new AndServerWebExchangeMatcher(loginPathMatcher, notAuthenticatedMatcher);
868+
return new PathPatternParserServerWebExchangeMatcher("/login/oauth2/code/{registrationId}");
874869
}
875870

876871
private ReactiveOAuth2UserService<OidcUserRequest, OidcUser> getOidcUserService() {

0 commit comments

Comments
 (0)