【发布时间】:2021-05-06 07:32:38
【问题描述】:
我有一个如下的 Spring WebFlux 安全性,并想使用属性控制 CSRF。如果在这里单独检查 CSRF,如何添加?
@Bean
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
return http.authorizeExchange().matchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
//.pathMatchers("/register", "/login").permitAll()
.anyExchange().authenticated()
.and().formLogin()
.securityContextRepository(securityContextRepository())
.and()
.exceptionHandling()
.accessDeniedHandler(new HttpStatusServerAccessDeniedHandler(HttpStatus.BAD_REQUEST))
.and().csrf().disable()
.build();
}
【问题讨论】:
标签: java spring-security spring-webflux