我正在尝试注册自己的AuthenticationProvider
。
我的配置:
@EnableWebFluxSecurity
class SecurityConfig {
@Bean
fun customAuthenticationProvider(): CustomAuthenticationProvider {
return CustomAuthenticationProvider()
}
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
return http.authorizeExchange()
.anyExchange().authenticated()
.and().build()
}
}
但是由于我使用webflux,所以无法使用WebSecurityConfigurerAdapter
。
启用这种AuthenticationProvider
的正确方法是什么?
答案 0 :(得分:1)
好的,我已经找到答案-我需要注册ReactiveAuthenticationManager
类型的Bean。来源:https://github.com/spring-projects/spring-security/issues/5565