Skip to content

Commit

Permalink
Create the CSRF token on the bounded elactic scheduler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tt4g committed Sep 16, 2020
1 parent 57c5ec2 commit 5c9b87b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.UUID;

import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

import org.springframework.http.HttpCookie;
import org.springframework.http.ResponseCookie;
Expand Down Expand Up @@ -67,7 +68,7 @@ public static CookieServerCsrfTokenRepository withHttpOnlyFalse() {

@Override
public Mono<CsrfToken> generateToken(ServerWebExchange exchange) {
return Mono.fromCallable(this::createCsrfToken);
return Mono.fromCallable(this::createCsrfToken).subscribeOn(Schedulers.boundedElastic());
}

@Override
Expand Down

0 comments on commit 5c9b87b

Please sign in to comment.