Skip to content

Commit 2f2c969

Browse files
author
Steve Riesenberg
committed
Document reactive support for CSRF BREACH
Issue spring-projectsgh-11959
1 parent 6641b8c commit 2f2c969

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/modules/ROOT/pages/migration/reactive.adoc

+39
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,45 @@ open fun securityWebFilterChain(http: HttpSecurity): SecurityWebFilterChain {
8080
----
8181
====
8282

83+
=== Protect against CSRF BREACH
84+
85+
You can opt into Spring Security 6's default support for BREACH protection of the `CsrfToken` using the following configuration:
86+
87+
.`CsrfToken` BREACH Protection
88+
====
89+
.Java
90+
[source,java,role="primary"]
91+
----
92+
@Bean
93+
SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
94+
XorServerCsrfTokenRequestAttributeHandler requestHandler = new XorServerCsrfTokenRequestAttributeHandler();
95+
// ...
96+
http
97+
// ...
98+
.csrf((csrf) -> csrf
99+
.csrfTokenRequestHandler(requestHandler)
100+
);
101+
return http.build();
102+
}
103+
----
104+
105+
.Kotlin
106+
[source,kotlin,role="secondary"]
107+
----
108+
@Bean
109+
open fun securityWebFilterChain(http: HttpSecurity): SecurityWebFilterChain {
110+
val requestHandler = XorServerCsrfTokenRequestAttributeHandler()
111+
// ...
112+
return http {
113+
// ...
114+
csrf {
115+
csrfTokenRequestHandler = requestHandler
116+
}
117+
}
118+
}
119+
----
120+
====
121+
83122
== Use `AuthorizationManager` for Method Security
84123

85124
xref:reactive/authorization/method.adoc[Method Security] has been xref:reactive/authorization/method.adoc#jc-enable-reactive-method-security-authorization-manager[improved] through {security-api-url}org/springframework/security/authorization/AuthorizationManager.html[the `AuthorizationManager` API] and direct use of Spring AOP.

0 commit comments

Comments
 (0)