title: Can't allow an anonymous access on my resource server
body: <p>I have two servers: authorization and resource, it works perfect if I am using <code>Bearer access_token</code> for my resource server but I need to have an anonymous access to some endpoints (i.e. <code>http://localhost:8080/games</code> but not <code>http://localhost:8080/games/new</code>). How to make it?<br>
  Now I'm trying to allow an anonymous access to all endpoints for test but it doesn't work. Below my configuration:  </p>
  
  <pre><code>@Configuration
  @EnableResourceServer
  public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter {
  
      private static final String RESOURCE_ID = "virto";
  
      @Override
      public void configure(ResourceServerSecurityConfigurer resources) {
          resources.resourceId(RESOURCE_ID);
          resources.tokenServices(tokenService());
      }
  
      @Override
      public void configure(HttpSecurity http) throws Exception {
          http.anonymous()
                  .and()
                  .authorizeRequests()
                  .antMatchers("/").permitAll()
                  .anyRequest().authenticated();
      }
  
      @Primary
      @Bean
      public RemoteTokenServices tokenService() {
          final String url = ServerConfig.USERS_HOST + "/oauth/check_token";
          RemoteTokenServices tokenService = new RemoteTokenServices();
          tokenService.setCheckTokenEndpointUrl(url);
          tokenService.setClientId("virto");
          tokenService.setClientSecret("secret");
  
          return tokenService;
      }
  }
  </code></pre>
  
  <p>And my <code>Application</code> class:  </p>
  
  <pre><code>@SpringBootApplication
  @EnableKafka
  @EnableAutoConfiguration
  public class Application {
  
      public static void main(String[] args) {
          ApplicationContext ctx = SpringApplication
                  .run(Application.class, args);
          DispatcherServlet dispatcherServlet = (DispatcherServlet)ctx
                  .getBean("dispatcherServlet");
          dispatcherServlet.setThrowExceptionIfNoHandlerFound(true);
      }
  }
  </code></pre>
  
  <p>Now if I'm trying to get an access to some endpoint without access token I'm getting the next message in the browser:  </p>
  
  <pre><code>&lt;oauth&gt;
      &lt;error_description&gt;
          Full authentication is required to access this resource
      &lt;/error_description&gt;
      &lt;error&gt;unauthorized&lt;/error&gt;
  &lt;/oauth&gt;
  </code></pre>