问题
Spring security in the servlet stack ( web ) allows you to customize the OAuth2 login redirection endpoint base uri in the Oauth2 authorization code grant flow as given here. I am trying to do the same for the reactive stack with Spring webflux. The github issue here mentions an authorizationRequestResolver and authenticationMatcher on the Oauth2LoginSpec that can be used to customize the base uri but I am unable to figure out how. Can someone please help me out with the configuration?
回答1:
In WebFlux applications you can use the authenticationMatcher().
http
.authorizeExchange(exchanges -> exchanges
.anyExchange().authenticated()
)
.oauth2Login(oauth2 -> oauth2
.authenticationMatcher(new PathPatternParserServerWebExchangeMatcher("/login/oauth2/code/{registrationId}"))
);
来源:https://stackoverflow.com/questions/64429271/how-to-customize-the-oauth2-login-redirection-endpoint-base-uri-with-spring-secu