【发布时间】:2019-07-26 05:27:50
【问题描述】:
当我开发一个非反应式应用程序并在身份验证中使用 rememberMe 功能时,我只是扩展 WebSecurityConfigurerAdapter 类并覆盖 configure(HttpSecurity httpSecurity) 方法。在这种情况下,我在 httpSecurity 对象中有一个 rememberMe() 方法。
但是当我使用 Spring WebFlux 时有区别。据我所知,我所要做的就是使用 ServerHttpSecurity 类的实例定义一个 SecurityWebFilterChain bean,通过调用如下链:
serverHttpSecurity.authorizeExchange()
.anyExchange().authenticated()
.and()
.httpBasic()
.build();
但是这里没有像 HttpSecurity 对象那样处理 rememberMe cookie 的方法,我可以用这种方式处理它:
httpSecurity.authorizeRequests()
.anyRequest().authenticated()
.and()
.httpBasic()
.and()
.rememberMe()
你知道有什么解决办法吗?
【问题讨论】:
-
你找到什么了吗?
标签: java spring spring-security java-8 spring-webflux