title: Spring oauth2 : Access any resource server endpoint without Authentication
body: <p>I have a scenario where I want to allow user to access a particular endpoint at resource server(running at 8098) from client application (running at 8080) without authentication. When ever I am trying to access it without client authentication it gives error access is denied. But when I access the same endpoint after user logged-in it working.</p>
  
  <p>I have following configuration at resource server:</p>
  
  <pre><code>    @Configuration
      @EnableResourceServer
      public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
  
          @Autowired
          private CustomUserDetailsService userDetailsService;
  
          public ResourceServerConfiguration() {
              super();
          }
  
          @Override
          public void configure(HttpSecurity http) throws Exception {
               http
                  .anonymous()
                  .and()
                  .authorizeRequests()
                  .antMatchers("/api/requestdetails/view-all-details/**").permitAll()
                  .anyRequest().authenticated()
          }
  }
  </code></pre>
  
  <p>basically I want to make this endpoint "/api/requestdetails/view-all-details/** unsecured. so user can access it without authentication.</p>