Spring webSecurity.ignoring() doesn't ignore custom filter

前端 未结 6 1485
轻奢々
轻奢々 2020-12-06 05:39

I have a set a custom authentication filter in my Spring 4 MVC + Security + Boot project. The filter does it\'s job well and now I want to disable the security for some URI

6条回答
  •  青春惊慌失措
    2020-12-06 06:40

    I think you also need it in the Filter class as well (extends RequestHeaderAuthenticationFilter) i.e.

    public class EAccessAuthenticationFilter extends RequestHeaderAuthenticationFilter {
        public EAccessAuthenticationFilter() {
            super(new RequestMatcher() {
                            RequestMatcher matcher = new AntPathRequestMatcher("/v1/api1");
                return matcher.matches(request);    
    
            });
        }
    }
    

提交回复
热议问题