title: keycloak CORS Headers in 401
body: <p>I have two keycloack clients,</p>
  
  <ul>
  <li>Angular 4: with <strong>Access Type credentials</strong> authentication</li>
  <li>A JAX RS Application (which will be the resource server): with <strong>bearer-only</strong> authentication! In this client we activate CORS, as shown by the following json.</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>{
    "realm": "demo-realm",
    "bearer-only": true,
    "auth-server-url": "http://demo-keycloack-server:8080/auth",
    "ssl-required": "external",
    "resource": "demo-server",
    "enable-cors": true
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The problem is that the HTTP Response with the status code 401 (Unauthorized) of the JAX-RS Application don't brings the required CORS Headers to javascript client!</p>
  
  <p>How can we add the respective CORS Header when the HTTP Status is 401 ?</p>