spring security 在 spring webflux 中的使用
https://blog.csdn.net/joker_2007/article/details/82736183pring5增加了reactive web模块,相应的在spring security中也增加了[webflux-web-security]模块,相对于spring security 在配置和使用方面有略微的差异,下面主要说明简单的配置和自定义用户信息的配置。import...
·
https://blog.csdn.net/joker_2007/article/details/82736183
pring5增加了reactive web模块,相应的在spring security中也增加了 [webflux-web-security] 模块,相对于spring security 在配置和使用方面有略微的差异,下面主要说明简单的配置和自定义用户信息的配置。
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
@Configuration
@EnableWebFluxSecurity
public class WebFluxSecurityConfig{
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http
.authorizeExchange()
//.pathMatchers("/loginPage").permitAll() //无需进行权限过滤的请求路径
.anyExchange().authenticated()
.and()
.httpBasic().and()
.formLogin()
//.loginPage("/loginPage") //自定义的登陆页面
;
return http.build();
}
}
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)