Module jakarta.mvc

Interface Csrf


  • public interface Csrf
    Cross Site Request Forgery (CSRF) interface with access to the CSRF header name and the CSRF token value. Implementations of this interface are injectable and accessible from EL via the MvcContext class as mvc.csrf.
    Since:
    1.0
    See Also:
    CsrfProtected
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CSRF_HEADER_NAME
      Property that can be used to configure the name of the HTTP header used for the CSRF token.
      static java.lang.String CSRF_PROTECTION
      Property that can be used to globally enable CSRF protection for an application.
      static java.lang.String DEFAULT_CSRF_HEADER_NAME
      The default value for CSRF_HEADER_NAME.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Returns the name of the CSRF form field or HTTP request header.
      java.lang.String getToken()
      Returns the value of the CSRF token.
    • Field Detail

      • CSRF_PROTECTION

        static final java.lang.String CSRF_PROTECTION
        Property that can be used to globally enable CSRF protection for an application. Values of this property must be of type Csrf.CsrfOptions.
        See Also:
        Constant Field Values
      • CSRF_HEADER_NAME

        static final java.lang.String CSRF_HEADER_NAME
        Property that can be used to configure the name of the HTTP header used for the CSRF token.
        See Also:
        Constant Field Values
    • Method Detail

      • getName

        java.lang.String getName()
        Returns the name of the CSRF form field or HTTP request header. This name is typically a constant.
        Returns:
        name of CSRF header.
      • getToken

        java.lang.String getToken()
        Returns the value of the CSRF token.
        Returns:
        value of CSRF token.