<div dir="ltr">Hi everybody,<div>I followed some suggestion and now I made authentication works as follow:</div><div><br></div><div><pre style="white-space:pre-wrap"><font color="#000000" face="arial, helvetica, sans-serif">1- The user call <a href="http://.../frontend" target="_blank">http://.../frontend</a></font></pre>
<div class="im"><pre style="white-space:pre-wrap"><font color="#000000" face="arial, helvetica, sans-serif">2- The frontend server redirects to the keycloak login</font></pre><pre style="white-space:pre-wrap"><font color="#000000" face="arial, helvetica, sans-serif">3- Keycloak authenticates the user and redirects to frontend server</font></pre>
</div><pre style="white-space:pre-wrap"><font color="#000000" face="arial, helvetica, sans-serif">4- The frontend server serves the AngularJS dashboard </font></pre><pre style="white-space:pre-wrap"><font color="#000000" face="arial, helvetica, sans-serif">
5- User clicks to something in AngularJS app, which will send request to <a href="http://localhost:8080/frontend/someEndpoint" target="_blank">http://localhost:8080/frontend/someEndpoint</a>

6- Frontend will re-send this to <a href="http://localhost:8080/backend/someBackendEndpoint" target="_blank">http://localhost:8080/backend/someBackendEndpoint</a>

7- After backend request is done and received in &quot;frontend&quot; app, it will resend it back to AngularJS with all the data.</font>
</pre><div><br></div><div>Now I would like to add authorization to backend api, so I added <a id="Securing_JAX-RS_and_RESTeasy" style="color:rgb(51,51,51);font-family:&#39;Lucida Grande&#39;,Geneva,Verdana,Arial,sans-serif;font-size:12px;line-height:18px">@RolesAllowed (&quot;role&quot;) but it does not work:</a></div>
<div>2014-04-23 23:17:10,694|WARN |core.ExceptionHandler|failed to execute</div><div>javax.ws.rs.ForbiddenException: HTTP 403 Forbidden</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.plugins.interceptors.RoleBasedSecurityFilter.filter(RoleBasedSecurityFilter.java:45)</div>
<div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:256)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:242)</div>
<div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:229)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)</div>
<div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)</div>
<div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)</div><div><span class="" style="white-space:pre">        </span>at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)</div>
<div><span class="" style="white-space:pre">        </span>at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)</div><div><br></div><div>I found out that the realmAccess is null and debugging I thinks the problem is during authentication when in org.keycloak.RSATokenVerifier at line:</div>
<div>            token = input.readJsonContent(AccessToken.class);<br></div><div><br></div><div>What do you think? What am I doing wrong this time?</div><div><br></div><div>Thanks.</div><div><br></div><div><br></div><div>
<br></div><div><br></div><div><div>--</div>Davide</div>
</div></div>