<div dir="ltr">Hi Pedro,<div><br></div><div>Thank you very much for your answer. Unfortunately that&#39;s what I was afraid. The problem is, we don&#39;t have a classic Java/Servlet application, so we can&#39;t use any of the Keycloak adapter available.</div><div><br></div><div>We might have to turn to another solution like Auth0.com which offers an integrated authorization plugin, unless we find the courage to write our own adapter.</div><div><br></div><div>Cheers,</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-26 22:43 GMT+10:00 Pedro Igor Silva <span dir="ltr">&lt;<a href="mailto:psilva@redhat.com" target="_blank">psilva@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Edouard,<br>
<br>
Right now, policy enforcement is only performed on application-side. For that, you need to enable policy enforcement to your keyclok.json as follows:<br>
<br>
{<br>
  &quot;policy-enforcer&quot;: {}<br>
}<br>
<br>
For more details, please take a look at [1].<br>
<br>
We don&#39;t enforce policies on server-side, at least for now. The user will always be able to log in and be redirect to your application with a code/token.<br>
<br>
@Stian already mentioned some ideas about a more deeper integrating between KC authentication and authorization services. But for now, what you want is not possible.<br>
<br>
[1] <a href="https://keycloak.gitbooks.io/authorization-services-guide/content/topics/enforcer/overview.html" rel="noreferrer" target="_blank">https://keycloak.gitbooks.io/<wbr>authorization-services-guide/<wbr>content/topics/enforcer/<wbr>overview.html</a><br>
<div><div class="h5"><br>
----- Original Message -----<br>
From: &quot;Edouard Kaiser&quot; &lt;<a href="mailto:edouard.kaiser@gmail.com">edouard.kaiser@gmail.com</a>&gt;<br>
To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
Sent: Thursday, August 25, 2016 10:02:32 PM<br>
Subject: [keycloak-user] Authorization at Keycloak level<br>
<br>
Hi everyone,<br>
<br>
We discovered Keycloak very recently (pretty impressive tool by the way, congrats to the maintainers!), and we&#39;ve been trying to configure a very simple authorization at the Keycloak level without success.<br>
<br>
Let me try to sum up what we are trying to achieve in our web-application.<br>
<br>
For a Keycloak Client, we would like to only allow the users with a particular Role to be able to login.<br>
<br>
We thought that to achieve this, we needed to do this:<br>
- Authorization enabled on the client<br>
- Create a new Role-Based policy ton a particular role<br>
- Create a Resource Permission to use the previously created Policy<br>
- Use this Resource Permission in the Default Resource of the Client<br>
<br>
We use openid-connect, and more specifically Google as the identity provider.<br>
<br>
By doing this, we thought that users without the role, trying to connect to our application through Keycloak, would be redirected to our application with an error of authentication, something like this in the redirection:<br>
<br>
/login/oauthVerify?client_<wbr>name=OidcClient&amp;error=<wbr>unauthorized&amp;error_<wbr>description=You%20are%20not%<wbr>20allowed%20to%20access%<wbr>20this%20application.&amp;state=<wbr>CrsA9f9bEzLWyjQfT5PN43MPxl_<wbr>PfMgvXZDQrEzCHi8<br>
<br>
Instead, it&#39;s like Keycloak does not check the Authorization configuration, it redirects to our webapp with a proper authorization code. Then the application is able to fetch the JWT successfully form the Keycloak token endpoint.<br>
<br>
Did we miss something? Are we trying to solve our issue in the wrong way ?<br>
<br>
Thank you all for your help,<br>
<br>
</div></div>______________________________<wbr>_________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/keycloak-user</a><br>
</blockquote></div><br></div>