Class DefaultCsrfToken
- java.lang.Object
-
- org.springframework.security.web.server.csrf.DefaultCsrfToken
-
- All Implemented Interfaces:
java.io.Serializable
,CsrfToken
public final class DefaultCsrfToken extends java.lang.Object implements CsrfToken
A CSRF token that is used to protect against CSRF attacks.- Since:
- 5.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultCsrfToken(java.lang.String headerName, java.lang.String parameterName, java.lang.String token)
Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getHeaderName()
Gets the HTTP header that the CSRF is populated on the response and can be placed on requests instead of the parameter.java.lang.String
getParameterName()
Gets the HTTP parameter name that should contain the token.java.lang.String
getToken()
Gets the token value.int
hashCode()
-
-
-
Constructor Detail
-
DefaultCsrfToken
public DefaultCsrfToken(java.lang.String headerName, java.lang.String parameterName, java.lang.String token)
Creates a new instance- Parameters:
headerName
- the HTTP header name to useparameterName
- the HTTP parameter name to usetoken
- the value of the token (i.e. expected value of the HTTP parameter of parametername).
-
-
Method Detail
-
getHeaderName
public java.lang.String getHeaderName()
Description copied from interface:CsrfToken
Gets the HTTP header that the CSRF is populated on the response and can be placed on requests instead of the parameter. Cannot be null.- Specified by:
getHeaderName
in interfaceCsrfToken
- Returns:
- the HTTP header that the CSRF is populated on the response and can be placed on requests instead of the parameter
-
getParameterName
public java.lang.String getParameterName()
Description copied from interface:CsrfToken
Gets the HTTP parameter name that should contain the token. Cannot be null.- Specified by:
getParameterName
in interfaceCsrfToken
- Returns:
- the HTTP parameter name that should contain the token.
-
getToken
public java.lang.String getToken()
Description copied from interface:CsrfToken
Gets the token value. Cannot be null.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-