【发布时间】:2020-01-16 20:37:52
【问题描述】:
在 Spring Web(非响应式)中,我们可以为 oauth2login 设置成功和失败处理程序,如下所示:
http.oauth2Login()
.successHandler(oauth2AuthenticationSuccessHandler)
.failureHandler(oauth2AuthenticationFailureHandler)
但在 WebFlux 中,我们没有这些方法。当我查看ServerHttpSecurity.configure 时,我看到处理程序是硬编码的:
protected void configure(ServerHttpSecurity http) {
...
RedirectServerAuthenticationSuccessHandler redirectHandler = new RedirectServerAuthenticationSuccessHandler();
authenticationFilter.setAuthenticationSuccessHandler(redirectHandler);
authenticationFilter.setAuthenticationFailureHandler(new ServerAuthenticationFailureHandler() {
@Override
public Mono<Void> onAuthenticationFailure(WebFilterExchange webFilterExchange,
AuthenticationException exception) {
return Mono.error(exception);
}
});
...
}
我们是否有计划在近期的 Spring 版本中使这些可配置?我应该为此创建一张票吗?而且,目前,有什么方法可以覆盖这些?
【问题讨论】:
标签: spring spring-security spring-security-oauth2 spring-webflux spring-oauth2