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 SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<CsrfToken>generateToken(org.springframework.web.server.ServerWebExchange exchange) Generates aCsrfTokenreactor.core.publisher.Mono<CsrfToken>loadToken(org.springframework.web.server.ServerWebExchange exchange) Loads the expectedCsrfTokenfrom theServerWebExchangereactor.core.publisher.Mono<Void>Saves theCsrfTokenusing theServerWebExchange.
- 
Method Details- 
generateTokenreactor.core.publisher.Mono<CsrfToken> generateToken(org.springframework.web.server.ServerWebExchange exchange) Generates aCsrfToken- Parameters:
- exchange- the- ServerWebExchangeto use
- Returns:
- the CsrfTokenthat was generated. Cannot be null.
 
- 
saveTokenreactor.core.publisher.Mono<Void> saveToken(org.springframework.web.server.ServerWebExchange exchange, CsrfToken token) Saves theCsrfTokenusing theServerWebExchange. If theCsrfTokenis null, it is the same as deleting it.- Parameters:
- exchange- the- ServerWebExchangeto use
- token- the- CsrfTokento save or null to delete
 
- 
loadTokenreactor.core.publisher.Mono<CsrfToken> loadToken(org.springframework.web.server.ServerWebExchange exchange) Loads the expectedCsrfTokenfrom theServerWebExchange- Parameters:
- exchange- the- ServerWebExchangeto use
- Returns:
- the CsrfTokenor null if none exists
 
 
-