title: Spring Security CORS filter not working
body: <p>I'm using spring security with OAuth2 (version: 4.0.4.RELEASE) and spring (verison: 4.3.1.RELEASE). </p>
  
  <p>I'm developing frontend in Angular and I'm using grunt connect:dev (<a href="http://127.0.0.1:9000" rel="noreferrer">http://127.0.0.1:9000</a>). When I trying to login by localhost address everything working fine but from other I'm getting error:</p>
  
  <p>"XMLHttpRequest cannot load <a href="http://localhost:8084/oauth/token?client_id=MY_CLIENT_ID" rel="noreferrer">http://localhost:8084/oauth/token?client_id=MY_CLIENT_ID</a>. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://127.0.0.1:9000" rel="noreferrer">http://127.0.0.1:9000</a>' is therefore not allowed access. The response had HTTP status code 401."</p>
  
  <p>I have configured mapping (Overrided public void addCorsMappings(CorsRegistry registry)) in WebMvcConfigurerAdapter (like below) but it still not working for <a href="http://127.0.0.1:9000" rel="noreferrer">http://127.0.0.1:9000</a>. </p>
  
  <pre><code>    registry.addMapping("/**")
              .allowedOrigins("http://127.0.0.1:9000")
              .allowedMethods("POST", "OPTIONS", "GET", "DELETE", "PUT")
              .allowedHeaders("X-Requested-With,Origin,Content-Type,Accept,Authorization")
              .allowCredentials(true).maxAge(3600);
  </code></pre>
  
  <p>Configuration based on: <a href="https://spring.io/guides/gs/rest-service-cors/" rel="noreferrer">https://spring.io/guides/gs/rest-service-cors/</a></p>
  
  <p>Please, point me the right directon to resolve this issue.</p>