Interface ServerCsrfTokenRepository
- All Known Implementing Classes:
CookieServerCsrfTokenRepository
,WebSessionServerCsrfTokenRepository
public interface ServerCsrfTokenRepository
An API to allow changing the method in which the expected
CsrfToken
is
associated to the ServerWebExchange
. For example, it may be stored in
WebSession
.- Since:
- 5.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<CsrfToken>
generateToken
(org.springframework.web.server.ServerWebExchange exchange) Generates aCsrfToken
reactor.core.publisher.Mono<CsrfToken>
loadToken
(org.springframework.web.server.ServerWebExchange exchange) Loads the expectedCsrfToken
from theServerWebExchange
reactor.core.publisher.Mono<Void>
Saves theCsrfToken
using theServerWebExchange
.
-
Method Details
-
generateToken
reactor.core.publisher.Mono<CsrfToken> generateToken(org.springframework.web.server.ServerWebExchange exchange) Generates aCsrfToken
- Parameters:
exchange
- theServerWebExchange
to use- Returns:
- the
CsrfToken
that was generated. Cannot be null.
-
saveToken
reactor.core.publisher.Mono<Void> saveToken(org.springframework.web.server.ServerWebExchange exchange, CsrfToken token) Saves theCsrfToken
using theServerWebExchange
. If theCsrfToken
is null, it is the same as deleting it.- Parameters:
exchange
- theServerWebExchange
to usetoken
- theCsrfToken
to save or null to delete
-
loadToken
reactor.core.publisher.Mono<CsrfToken> loadToken(org.springframework.web.server.ServerWebExchange exchange) Loads the expectedCsrfToken
from theServerWebExchange
- Parameters:
exchange
- theServerWebExchange
to use- Returns:
- the
CsrfToken
or null if none exists
-