Skip to content

Commit 2c297fb

Browse files
tt4gjzheaux
authored andcommitted
Create the CSRF token on the bounded elactic scheduler
The CSRF token is generated by UUID.randomUUID() which is I/O blocking operation. This commit changes the subscriber thread to the bounded elactic scheduler. Closes gh-9018
1 parent 57c5ec2 commit 2c297fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.UUID;
2020

2121
import reactor.core.publisher.Mono;
22+
import reactor.core.scheduler.Schedulers;
2223

2324
import org.springframework.http.HttpCookie;
2425
import org.springframework.http.ResponseCookie;
@@ -67,7 +68,7 @@ public static CookieServerCsrfTokenRepository withHttpOnlyFalse() {
6768

6869
@Override
6970
public Mono<CsrfToken> generateToken(ServerWebExchange exchange) {
70-
return Mono.fromCallable(this::createCsrfToken);
71+
return Mono.fromCallable(this::createCsrfToken).subscribeOn(Schedulers.boundedElastic());
7172
}
7273

7374
@Override

0 commit comments

Comments
 (0)