0

I am registering a filter as shown below -

    @Bean
    public FilterRegistrationBean jwtFilter() {
        final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(new AuthenticationFilter());
        registrationBean.addUrlPatterns("/secure/*");
        registrationBean.setOrder(1);

        return registrationBean;
    }

When i use the following url this filter works -

localhost:8080/secure/getUsers

But does not work for the below url -

localhost:8080/skeleton-service/secure/getUsers

sijo josan
  • 43
  • 2
  • 7

1 Answers1

0

Please try

registrationBean.addUrlPatterns("secure/*","skeleton-service/*");
GaneshSreeju
  • 303
  • 1
  • 13
  • is there a wildcard that i can specify before /secure, which means that any url preceding /secure should also be included? – sijo josan Oct 22 '17 at 18:07
  • @sijojosan There is no way in Servlet Specification to use regexp or some pattern matching. Rules are pretty simple. take a look https://stackoverflow.com/a/8571248/1032167 – varren Oct 22 '17 at 18:11
  • Better good pattern is you have to bring it under same root pattern .like under " /secure/*" – GaneshSreeju Oct 22 '17 at 18:13