[英]Spring WebFlux + Security - do we have the "remember-me" feature?
當我開發非反應性應用程序並在身份驗證中使用 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()
你知道有什么解決辦法嗎?
評論說使用更長的會話過期時間並將會話卸載到外部數據存儲(即 Redis)。 這樣,您可以將信息存儲在數據庫中而不是 cookie 中。
他們說使用 Spring Session 項目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.