title: Disable Basic Authentication for a specific URL Spring
body: <p>I am new to Spring, and I need to enable Basic authentication for 8/10 URLs of my rest controllers, and the other 2 should be accessible without any Basic Authentication.
  I am using gradle to build by application, so there is no xml file involved as such. (I saw a few solutions with a web.xml, I do not have one)
  Here is my web security configuration:</p>
  
  <pre><code> @Configuration
  @EnableWebSecurity
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Override
      public void configure(WebSecurity web) throws Exception {
          super.configure(web);
          web.ignoring().antMatchers("/abcd/**");
  
      }
  
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
          auth.inMemoryAuthentication().withUser("user").password("password");
  
      }
  }
  </code></pre>
  
  <p>Here is my controller:</p>
  
  <pre><code>    @RestController
  @RequestMapping(value = "/abcd")
  public class PaymentController implements ElasticSearchConstants {
  
      @RequestMapping(value = "/sample", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
      public static void authExpemtedController(HttpServletRequest request, HttpServletResponse response) throws Exception {
          //do something
      }
  }
  </code></pre>
  
  <p>I tried the web.ignoring().antMatchers("/abcd/"); not helping. I always get a 401 error when I try from postman:
  {
    "timestamp": 1492274727955,
    "status": 401,
    "error": "Unauthorized",
    "message": "Full authentication is required to access this resource",
    "path": "/abcd/sample"
  }</p>
  
  <p>I have a requirement to expose an API like this, that does not need ANY authentication, where as the other APIs need to be authernticated.</p>
  
  <p>Thanks for the help in advance</p>
  
  <p>UPDATE:
  I know about the http.authoriseRequest().antMatchers("/abcd").permitAll()
  This method only allows any user to access. I do not want to pass ANY user information at all to this API.</p>