跳到主要内容
版本:7.0.2

使用 CSRF 进行测试

DeepSeek V3 中英对照 Testing CSRF Testing with CSRF

Spring Security 也为 WebTestClient 提供了 CSRF 测试支持——例如:

import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf;

this.rest
// provide a valid CSRF token
.mutateWith(csrf())
.post()
.uri("/login")
...