如何使用SpringSecurityWebflux自定义OAuth2登录重定向端点基本uri



servlet堆栈(web(中的Spring安全性允许您自定义OAuth2授权代码授予流中的OAuth2登录重定向端点基uri,如下所示。我正在尝试使用Spring-webflux对反应式堆栈执行同样的操作。这里的github问题提到了Oauth2LoginSpec上的authorizationRequestResolver和authenticationMatcher,它可以用于自定义基本uri,但我不知道如何实现。有人能帮我配置一下吗?

在WebFlux应用程序中,您可以使用authenticationMatcher()

http
.authorizeExchange(exchanges -> exchanges
.anyExchange().authenticated()
)
.oauth2Login(oauth2 -> oauth2
.authenticationMatcher(new PathPatternParserServerWebExchangeMatcher("/login/oauth2/code/{registrationId}"))
);

最新更新