File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
main/java/org/springframework/security/web/server/csrf
test/java/org/springframework/security/web/server/csrf Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -129,8 +129,8 @@ public static void skipExchange(ServerWebExchange exchange) {
129
129
130
130
private Mono <Void > validateToken (ServerWebExchange exchange ) {
131
131
return this .csrfTokenRepository .loadToken (exchange )
132
- .switchIfEmpty (Mono
133
- .defer (() -> Mono .error (new CsrfException ("An expected CSRF token cannot be found" ))))
132
+ .switchIfEmpty (
133
+ Mono .defer (() -> Mono .error (new CsrfException ("An expected CSRF token cannot be found" ))))
134
134
.filterWhen ((expected ) -> containsValidCsrfToken (exchange , expected ))
135
135
.switchIfEmpty (Mono .defer (() -> Mono .error (new CsrfException ("Invalid CSRF Token" )))).then ();
136
136
}
Original file line number Diff line number Diff line change 34
34
import org .springframework .web .bind .annotation .RequestMapping ;
35
35
import org .springframework .web .bind .annotation .RestController ;
36
36
import org .springframework .web .reactive .function .BodyInserters ;
37
- import org .springframework .web .server .ServerWebExchange ;
38
37
import org .springframework .web .server .WebFilterChain ;
39
38
import org .springframework .web .server .WebSession ;
40
39
@@ -92,7 +91,7 @@ public void filterWhenPostAndEstablishedCsrfTokenAndRequestMissingTokenThenCsrfE
92
91
StepVerifier .create (result ).verifyComplete ();
93
92
assertThat (this .post .getResponse ().getStatusCode ()).isEqualTo (HttpStatus .FORBIDDEN );
94
93
StepVerifier .create (this .post .getResponse ().getBodyAsString ())
95
- .assertNext (b -> assertThat (b ).contains ("An expected CSRF token cannot be found" ));
94
+ .assertNext (( body ) -> assertThat (body ).contains ("An expected CSRF token cannot be found" ));
96
95
}
97
96
98
97
@ Test
You can’t perform that action at this time.
0 commit comments