Testing with CSRF
Spring Security also provides support for CSRF testing with WebTestClient
— for example:
-
Java
-
Kotlin
this.rest
// provide a valid CSRF token
.mutateWith(csrf())
.post()
.uri("/login")
...
this.rest
// provide a valid CSRF token
.mutateWith(csrf())
.post()
.uri("/login")
...