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 created with a call to UUID.randomUUID which is blocking.
This change ensures this blocking call is done on the bounded elastic scheduler which supports blocking calls.

Fixes gh-8128
  • Loading branch information
cbornet authored and rwinch committed May 18, 2020
1 parent 9f33ce3 commit 21c1d98
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.util.Assert;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
Expand Down Expand Up @@ -48,7 +49,9 @@ public class WebSessionServerCsrfTokenRepository

@Override
public Mono<CsrfToken> generateToken(ServerWebExchange exchange) {
return Mono.fromCallable(() -> createCsrfToken());
return Mono.just(exchange)
.publishOn(Schedulers.boundedElastic())
.fromCallable(() -> createCsrfToken());
}

@Override
Expand Down

0 comments on commit 21c1d98

Please sign in to comment.