Skip to content

Commit 0201c31

Browse files
committed
Fix Checkstyle for CsrfWebFilter
Issue gh-9337
1 parent a1083d9 commit 0201c31

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

web/src/main/java/org/springframework/security/web/server/csrf/CsrfWebFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ public static void skipExchange(ServerWebExchange exchange) {
131131

132132
private Mono<Void> validateToken(ServerWebExchange exchange) {
133133
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"))))
136136
.filterWhen((expected) -> containsValidCsrfToken(exchange, expected))
137137
.switchIfEmpty(Mono.defer(() -> Mono.error(new CsrfException("Invalid CSRF Token")))).then();
138138
}

web/src/test/java/org/springframework/security/web/server/csrf/CsrfWebFilterTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.springframework.web.bind.annotation.RequestMapping;
3535
import org.springframework.web.bind.annotation.RestController;
3636
import org.springframework.web.reactive.function.BodyInserters;
37-
import org.springframework.web.server.ServerWebExchange;
3837
import org.springframework.web.server.WebFilterChain;
3938
import org.springframework.web.server.WebSession;
4039

@@ -92,7 +91,7 @@ public void filterWhenPostAndEstablishedCsrfTokenAndRequestMissingTokenThenCsrfE
9291
StepVerifier.create(result).verifyComplete();
9392
assertThat(this.post.getResponse().getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
9493
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"));
9695
}
9796

9897
@Test

0 commit comments

Comments
 (0)