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

        clone, finalize, getClass, 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
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object