Class 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:
    3.2
    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
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 use
        parameterName - the HTTP parameter name to use
        token - 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 interface CsrfToken
        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 interface CsrfToken
        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.
        Specified by:
        getToken in interface CsrfToken
        Returns:
        the token value