title: How to avoid custome filter to run for non-secured urls in spring-security
body: <p>I am building a REST based web application and i have applied the spring security to it successfully but my concern is that i have added a custom filter</p>
  
  <pre><code>http
          .authorizeRequests()
          .antMatchers("/mypro/userCont/signup").permitAll()
          .and()
          .addFilterBefore(new CustomFilter(), UsernamePasswordAuthenticationFilter.class)
          .httpBasic();
  </code></pre>
  
  <p>i want that this filter should only run for secured urls not for unsecured urls if it get runs for non secured url then it should not interrupt me to get resource on non-secure url.
  My scenerio is if user is not logged in for secured url custom filter should be run which check the <code>Principal</code> using below code:</p>
  
  <pre><code>Authentication auth = (Authentication) SecurityContextHolder.getContext().getAuthentication();
  </code></pre>
  
  <p>if the <code>auth</code> is <code>null</code> user should seen default spring security login popup
  and if i hit the non secure url i should get to the resource.
  Can anyone help me.</p>