reactive-test-web-csrf.md 422 字节
Newer Older
茶陵後's avatar
茶陵後 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
# Testing with CSRF

Spring Security also provides support for CSRF testing with `WebTestClient`.
For example:

Java

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

Kotlin

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

[Testing Authentication](authentication.html)[Testing OAuth 2.0](oauth2.html)