Skip to content

Commit 77a1bef

Browse files
committed
Fix Checkstyle for CsrfWebFilter
Issue gh-9337
1 parent 61b75bb commit 77a1bef

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
@@ -129,8 +129,8 @@ public static void skipExchange(ServerWebExchange exchange) {
129129

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

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)