Class WebSessionServerCsrfTokenRepository
- java.lang.Object
-
- org.springframework.security.web.server.csrf.WebSessionServerCsrfTokenRepository
-
- All Implemented Interfaces:
ServerCsrfTokenRepository
public class WebSessionServerCsrfTokenRepository extends java.lang.Object implements ServerCsrfTokenRepository
- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description WebSessionServerCsrfTokenRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.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<java.lang.Void>saveToken(org.springframework.web.server.ServerWebExchange exchange, CsrfToken token)Saves theCsrfTokenusing theServerWebExchange.voidsetHeaderName(java.lang.String headerName)voidsetParameterName(java.lang.String parameterName)Sets theHttpServletRequestparameter name that theCsrfTokenis expected to appear onvoidsetSessionAttributeName(java.lang.String sessionAttributeName)Sets theHttpSessionattribute name that theCsrfTokenis stored in
-
-
-
Method Detail
-
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<java.lang.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
public void setParameterName(java.lang.String parameterName)
Sets theHttpServletRequestparameter name that theCsrfTokenis expected to appear on- Parameters:
parameterName- the new parameter name to use
-
setHeaderName
public void setHeaderName(java.lang.String headerName)
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
public void setSessionAttributeName(java.lang.String sessionAttributeName)
Sets theHttpSessionattribute name that theCsrfTokenis stored in- Parameters:
sessionAttributeName- the new attribute name to use
-
-