【发布时间】:2020-11-18 17:17:30
【问题描述】:
我一直在尝试使用我自己的自定义身份验证方法在 Web Flux 中启用 Spring Security。到目前为止一切顺利,但我无法使用 permitall 允许某些 URL 模式。
我尝试创建不同的 SecurityWebFilterChain bean,也尝试了完全不同的配置,但似乎没有什么对我有用。
这是我的 SecurityWebFilterChain
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
return http.csrf()
.disable()
.httpBasic()
.disable()
.formLogin()
.disable()
.logout()
.disable()
.authenticationManager(this.authenticationManager())
.securityContextRepository(this.securityContextRepository())
.authorizeExchange()
.pathMatchers("**/signal/health").permitAll()
.pathMatchers("**/order").permitAll()
.and()
.authorizeExchange()
.anyExchange()
.authenticated()
.and()
.build();
}
我有一个内部健康检查系统,它会在我的应用程序启动后立即运行,所以我希望允许这样做。
此外,我还想允许其他一对或 URI,但上面的配置对我不起作用。
一切都是为了验证。
我在这里做错了什么?
【问题讨论】:
标签: spring spring-boot spring-security spring-webflux