Class CsrfProtectionMatcher

  • All Implemented Interfaces:
    org.springframework.security.web.util.matcher.RequestMatcher

    public class CsrfProtectionMatcher
    extends java.lang.Object
    implements org.springframework.security.web.util.matcher.RequestMatcher
    This matcher returns true for POST method and the request's servlet path does not match with the combined list of csrf.allowed.url.patterns from properties file and csrfAllowedUrlPatterns from spring configuration. Otherwise, it will return false.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.springframework.security.web.util.matcher.RequestMatcher

        org.springframework.security.web.util.matcher.RequestMatcher.MatchResult
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.List<java.lang.String> getCsrfAllowedUrlPatterns()  
      boolean matches​(javax.servlet.http.HttpServletRequest request)  
      void setCsrfAllowedUrlPatterns​(java.util.List<java.lang.String> csrfAllowedUrlPatterns)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.security.web.util.matcher.RequestMatcher

        matcher
    • Constructor Detail

      • CsrfProtectionMatcher

        public CsrfProtectionMatcher()
    • Method Detail

      • matches

        public boolean matches​(javax.servlet.http.HttpServletRequest request)
        Specified by:
        matches in interface org.springframework.security.web.util.matcher.RequestMatcher
      • getCsrfAllowedUrlPatterns

        protected java.util.List<java.lang.String> getCsrfAllowedUrlPatterns()
        Returns:
        the csrfAllowedUrlPatterns
      • setCsrfAllowedUrlPatterns

        public void setCsrfAllowedUrlPatterns​(java.util.List<java.lang.String> csrfAllowedUrlPatterns)
        Parameters:
        csrfAllowedUrlPatterns - the csrfAllowedUrlPatterns to set