Class DefaultXsrfTokenValidationManager

  • All Implemented Interfaces:
    XsrfTokenValidationManager

    public class DefaultXsrfTokenValidationManager
    extends Object
    implements XsrfTokenValidationManager
    Validates the XSRF tokens for protected struts actions Used in NeoSecurityFilter

    Configuring XSRF protection happens at the method level, and can be done either by adding a XsrfProtectionExcluded or RequireSecurityToken annotation to the method, or by adding a <param name="RequireSecurityToken">[true|false]</param> parameter to the action configuration in struts.xml.

    XsrfProtectionExcluded annotations override any other settings. Configuration in struts.xml will override RequireSecurityToken annotations. Behaviour when a method is not configured at all depends on the return values of SecurityLevelConfig.

    Requests containing the HTTP header X-Atlassian-Token: no-check will bypass the check and always succeed.

    • Constructor Detail

      • DefaultXsrfTokenValidationManager

        public DefaultXsrfTokenValidationManager​(com.atlassian.xwork.XsrfTokenGenerator tokenGenerator)
    • Method Detail

      • isRequestExempt

        public boolean isRequestExempt​(String actionName,
                                       javax.servlet.http.HttpServletRequest request)
        Description copied from interface: XsrfTokenValidationManager
        Check if XSRF token protection checks should be exempt for the given action and request.
        Specified by:
        isRequestExempt in interface XsrfTokenValidationManager
        Parameters:
        actionName - - the action name
        request - - the current HttpServletRequest
        Returns:
        true if the request should be exempt from xsrf check, false otherwise.
      • isRequestValid

        public boolean isRequestValid​(Class<?> actionClass,
                                      Method actionMethod,
                                      Map<String,​String> actionParams,
                                      javax.servlet.http.HttpServletRequest request)
        Description copied from interface: XsrfTokenValidationManager
        Check if this request passes XSRF token checks.
        Specified by:
        isRequestValid in interface XsrfTokenValidationManager
        Parameters:
        actionClass - - the current action class
        actionMethod - - the action method that is executed
        actionParams - - the action parameters
        request - - the current HttpServletRequest
        Returns:
        true if the request passes XSRF token validations, false otherwise.