Create the CSRF token on the bounded elactic scheduler
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
This commit is contained in:
parent
1e211b6558
commit
bfb401eeed
|
@ -18,6 +18,7 @@ package org.springframework.security.web.server.csrf;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
import reactor.core.scheduler.Schedulers;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
@ -48,7 +49,9 @@ public class WebSessionServerCsrfTokenRepository
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<CsrfToken> generateToken(ServerWebExchange exchange) {
|
public Mono<CsrfToken> generateToken(ServerWebExchange exchange) {
|
||||||
return Mono.fromCallable(() -> createCsrfToken());
|
return Mono.just(exchange)
|
||||||
|
.publishOn(Schedulers.boundedElastic())
|
||||||
|
.fromCallable(() -> createCsrfToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue