Marcus Da Coregio 34015944f2 Merge branch '5.8.x' into 6.0.x
Closes gh-12992
2023-04-11 09:57:52 -03:00

32 lines
622 B
Plaintext

= Testing with CSRF
Spring Security also provides support for CSRF testing with `WebTestClient` -- for example:
====
.Java
[source,java,role="primary"]
----
import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf;
this.rest
// provide a valid CSRF token
.mutateWith(csrf())
.post()
.uri("/login")
...
----
.Kotlin
[source,kotlin,role="secondary"]
----
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf
this.rest
// provide a valid CSRF token
.mutateWith(csrf())
.post()
.uri("/login")
...
----
====