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 @@ -131,8 +131,8 @@ public static void skipExchange(ServerWebExchange exchange) {
131
131
132
132
private Mono <Void > validateToken (ServerWebExchange exchange ) {
133
133
return this .csrfTokenRepository .loadToken (exchange )
134
- .switchIfEmpty (Mono
135
- .defer (() -> Mono .error (new CsrfException ("An expected CSRF token cannot be found" ))))
134
+ .switchIfEmpty (
135
+ Mono .defer (() -> Mono .error (new CsrfException ("An expected CSRF token cannot be found" ))))
136
136
.filterWhen ((expected ) -> containsValidCsrfToken (exchange , expected ))
137
137
.switchIfEmpty (Mono .defer (() -> Mono .error (new CsrfException ("Invalid CSRF Token" )))).then ();
138
138
}
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