<div dir="ltr">Hi Bill,<div><br></div><div>thanks, I wasn&#39;t fully aware of the AccountService. However, we&#39;ll need to implement a user management page within our application that gives access to all users and role mappings within the realm. So I suppose I would either have to access the admin console back-end via REST with a keycloak-admin-realm user or use the JPA entities from keycloak-model-jpa directly.</div>
<div><br></div><div>I would assume that this is a pretty standard use case though. After all, the only alternative would be exposing the admin console to end users. Or am I missing something?</div><div><br></div><div>Cheers,</div>
<div>Nils</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 4:45 PM, Bill Burke <span dir="ltr">&lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">User information can be obtained from the IDToken within<br>
KeycloakSecurityContext.  You can setup what information is in the<br>
IDToken via the claims page in each application/oauth client.<br>
<br>
For other user requests (like changing passwords), use the Account<br>
Service.  Every authenticated user has permission to access this REST<br>
API by default.<br>
<div class=""><br>
On 4/15/2014 10:41 AM, Nils Preusker wrote:<br>
&gt; By management REST API you mean the API the admin console uses?<br>
&gt;<br>
&gt; Just to make sure I understand your suggestion correctly:<br>
&gt;<br>
&gt; * I would use the management REST API (same API the admin console uses)<br>
&gt; from my backend application<br>
&gt; * my backend application would need a user (&quot;application user&quot;) within<br>
&gt; the keycloak-admin realm<br>
&gt; * when accessing the management REST API, I would add an &quot;Authorization:<br>
&gt; Bearer ...&quot; header with the token I can obtain from<br>
&gt; .../auth/rest/realms/MY-REALM/tokens/grants/access<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Nils<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Apr 15, 2014 at 3:10 PM, Bill Burke &lt;<a href="mailto:bburke@redhat.com">bburke@redhat.com</a><br>
</div><div class="">&gt; &lt;mailto:<a href="mailto:bburke@redhat.com">bburke@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     IMO, you should not use the model directly in your applications.  The<br>
&gt;     management REST API gives you full access to security metadata.  Use<br>
&gt;     that.  Plus, in the very near future (after beta-1 release) we&#39;ll be<br>
&gt;     implementing a cache and if you are modifying data directly, there will<br>
&gt;     be possibilities of this cache using stale data.<br>
&gt;<br>
&gt;     On 4/15/2014 4:30 AM, Stian Thorgersen wrote:<br>
&gt;      &gt; At some point we&#39;ll add a Java and REST api&#39;s for user<br>
&gt;     management. This will also include being able to register listeners<br>
&gt;     for user events (for example user created, user deleted, etc).<br>
&gt;      &gt;<br>
&gt;      &gt; In the mean time I don&#39;t see any issues with using<br>
&gt;     keycloak-model-jpa directly, especially not for read only. This API<br>
&gt;     will quite likely change between versions, and we won&#39;t support any<br>
&gt;     backwards compatibility. The &quot;official&quot; user management API once<br>
&gt;     it&#39;s ready will be more stable, but I&#39;m not sure when we&#39;ll have<br>
&gt;     time to implement that.<br>
&gt;      &gt;<br>
&gt;      &gt; ----- Original Message -----<br>
&gt;      &gt;&gt; From: &quot;Nils Preusker&quot; &lt;<a href="mailto:n.preusker@gmail.com">n.preusker@gmail.com</a><br>
</div><div><div class="h5">&gt;     &lt;mailto:<a href="mailto:n.preusker@gmail.com">n.preusker@gmail.com</a>&gt;&gt;<br>
&gt;      &gt;&gt; To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt;     &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
&gt;      &gt;&gt; Sent: Tuesday, 15 April, 2014 9:22:44 AM<br>
&gt;      &gt;&gt; Subject: [keycloak-user] Sharing users<br>
&gt;      &gt;&gt;<br>
&gt;      &gt;&gt; Hi, I have a question regarding user management and sharing<br>
&gt;     access to the<br>
&gt;      &gt;&gt; keycloak database between applications.<br>
&gt;      &gt;&gt;<br>
&gt;      &gt;&gt; While the keycloak admin console can be used to manage users, other<br>
&gt;      &gt;&gt; applications may also need to access the user database. Is there a<br>
&gt;      &gt;&gt; recommended way of accomplishing this?<br>
&gt;      &gt;&gt;<br>
&gt;      &gt;&gt; I&#39;ve been experimenting with adding keycloak-model-jpa to my<br>
&gt;     .war as a<br>
&gt;      &gt;&gt; dependency and looking at the bootstrapping in<br>
&gt;      &gt;&gt; org.keycloak.services.resources.KeycloakApplication. However, I<br>
&gt;     wasn&#39;t able<br>
&gt;      &gt;&gt; to get it to work yet and have the feeling that I might be going<br>
&gt;     the wrong<br>
&gt;      &gt;&gt; way here.<br>
&gt;      &gt;&gt;<br>
&gt;      &gt;&gt; Any hints?<br>
&gt;      &gt;&gt;<br>
&gt;      &gt;&gt; Cheers,<br>
&gt;      &gt;&gt; Nils<br>
&gt;      &gt;&gt;<br>
&gt;      &gt;&gt; _______________________________________________<br>
&gt;      &gt;&gt; keycloak-user mailing list<br>
</div></div>&gt;      &gt;&gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a> &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
<div class="">&gt;      &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt;      &gt; _______________________________________________<br>
&gt;      &gt; keycloak-user mailing list<br>
</div>&gt;      &gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a> &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
<div class="">&gt;      &gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt;      &gt;<br>
&gt;<br>
&gt;     --<br>
&gt;     Bill Burke<br>
&gt;     JBoss, a division of Red Hat<br>
&gt;     <a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
&gt;     _______________________________________________<br>
&gt;     keycloak-user mailing list<br>
</div>&gt;     <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a> &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
<div class="HOEnZb"><div class="h5">&gt;     <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; keycloak-user mailing list<br>
&gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt;<br>
<br>
--<br>
Bill Burke<br>
JBoss, a division of Red Hat<br>
<a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
_______________________________________________<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" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
</div></div></blockquote></div><br></div>