title: How to allow certain endpoint in spring security to be allowed without authentication?
body: <p>I have Spring Boot Rest API web app in which I am using spring security to have most endpoints to require authentication. 
  This is part of code:</p>
  
  <pre><code>public class SecurityConfig extends WebSecurityConfigurerAdapter {
  ....
  @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.csrf().disable()
                  .requestMatchers()
                  .antMatchers("/oauth/token")
                  .and()
                  .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                  .and()
                  .authorizeRequests()
                  .antMatchers(HttpMethod.OPTIONS).permitAll()
                  .anyRequest().authenticated();
      }
  </code></pre>
  
  <p>Can some one explain what each line begining with http.csrf means?</p>
  
  <p>How can I modify above code so that enpoint /bars/pk can be allowed to be accessed without requiring authentication just as if there was no Spring Security ?</p>