diff --git a/web/src/main/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepository.java b/web/src/main/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepository.java index 9a4714f58a..e2a9a81ada 100644 --- a/web/src/main/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepository.java +++ b/web/src/main/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepository.java @@ -52,8 +52,7 @@ public class WebSessionServerCsrfTokenRepository implements ServerCsrfTokenRepos @Override public Mono generateToken(ServerWebExchange exchange) { - Mono.just(exchange).publishOn(Schedulers.boundedElastic()); - return Mono.fromCallable(() -> createCsrfToken()); + return Mono.fromCallable(() -> createCsrfToken()).subscribeOn(Schedulers.boundedElastic()); } @Override