Class WebSessionServerCsrfTokenRepository
java.lang.Object
org.springframework.security.web.server.csrf.WebSessionServerCsrfTokenRepository
- All Implemented Interfaces:
ServerCsrfTokenRepository
public class WebSessionServerCsrfTokenRepository
extends Object
implements ServerCsrfTokenRepository
- Since:
- 5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier 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.voidsetHeaderName(String headerName) voidsetParameterName(String parameterName) Sets theServerWebExchangeparameter name that theCsrfTokenis expected to appear onvoidsetSessionAttributeName(String sessionAttributeName) Sets theWebSessionattribute name that theCsrfTokenis stored in
-
Constructor Details
-
WebSessionServerCsrfTokenRepository
public WebSessionServerCsrfTokenRepository()
-
-
Method Details
-
generateToken
public reactor.core.publisher.Mono<CsrfToken> generateToken(org.springframework.web.server.ServerWebExchange exchange) Description copied from interface:ServerCsrfTokenRepositoryGenerates aCsrfToken- Specified by:
generateTokenin interfaceServerCsrfTokenRepository- Parameters:
exchange- theServerWebExchangeto use- Returns:
- the
CsrfTokenthat was generated. Cannot be null.
-
saveToken
public reactor.core.publisher.Mono<Void> saveToken(org.springframework.web.server.ServerWebExchange exchange, CsrfToken token) Description copied from interface:ServerCsrfTokenRepositorySaves theCsrfTokenusing theServerWebExchange. If theCsrfTokenis null, it is the same as deleting it.- Specified by:
saveTokenin interfaceServerCsrfTokenRepository- Parameters:
exchange- theServerWebExchangeto usetoken- theCsrfTokento save or null to delete
-
loadToken
public reactor.core.publisher.Mono<CsrfToken> loadToken(org.springframework.web.server.ServerWebExchange exchange) Description copied from interface:ServerCsrfTokenRepositoryLoads the expectedCsrfTokenfrom theServerWebExchange- Specified by:
loadTokenin interfaceServerCsrfTokenRepository- Parameters:
exchange- theServerWebExchangeto use- Returns:
- the
CsrfTokenor null if none exists
-
setParameterName
Sets theServerWebExchangeparameter name that theCsrfTokenis expected to appear on- Parameters:
parameterName- the new parameter name to use
-
setHeaderName
Sets the header name that theCsrfTokenis expected to appear on and the header that the response will contain theCsrfToken.- Parameters:
headerName- the new header name to use
-
setSessionAttributeName
Sets theWebSessionattribute name that theCsrfTokenis stored in- Parameters:
sessionAttributeName- the new attribute name to use
-