<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle"></style><style></style><style></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">The JSON response (string) does NOT contain any roles.
<div><br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF433446" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Stian Thorgersen [sthorger@redhat.com]<br>
<b>Sent:</b> Wednesday, September 30, 2015 7:39 AM<br>
<b>To:</b> Remi Cartier<br>
<b>Cc:</b> Marek Posolda; keycloak-dev@lists.jboss.org<br>
<b>Subject:</b> Re: [keycloak-dev] Admin REST - User Roles<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Does the response actually contain the roles though? You're parsing to&nbsp;<span style="font-size:12.8px">UserRepresentation then printing it out afterwards.</span>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 30 September 2015 at 13:24, Remi Cartier <span dir="ltr">
&lt;<a href="mailto:remi.cartier@imetrik.com" target="_blank">remi.cartier@imetrik.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-color:rgb(204,204,204); border-left-style:solid; padding-left:1ex">
<div bgcolor="#FFFFFF">
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
<div>Marek,</div>
<div><br>
</div>
<div>I see, thank you for your reply.</div>
<div><br>
</div>
<div>Wouldn't it be less error/question prone if the endpoint returning all the users wouldn't show the *roles attributes ?</div>
<div>Because they will always be null if I understood correctly.</div>
<div><br>
</div>
<div>Regards.</div>
<div><br>
</div>
<div>Rémi.</div>
<br>
<div style="font-family:'Times New Roman'; color:rgb(0,0,0); font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Marek Posolda [<a href="mailto:mposolda@redhat.com" target="_blank">mposolda@redhat.com</a>]<br>
<b>Sent:</b> Wednesday, September 30, 2015 6:21 AM<br>
<b>To:</b> Remi Cartier; <a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">
keycloak-dev@lists.jboss.org</a><br>
<b>Subject:</b> Re: [keycloak-dev] Admin REST - User Roles<br>
</font><br>
</div>
<div>
<div class="h5">
<div></div>
<div>
<div>Hi,<br>
<br>
to retrieve realm role mappings of user, you need to use the endpoint like <a href="http://localhost:8080/auth/admin/realms/demo/users/" target="_blank">
http://localhost:8080/auth/admin/realms/demo/users/</a>{userid}/role-mappings/realm . See the docs for details:
<a href="http://keycloak.github.io/docs/rest-api/overview-index.html" target="_blank">
http://keycloak.github.io/docs/rest-api/overview-index.html</a><br>
<br>
Marek<br>
<br>
On 29/09/15 19:06, Remi Cartier wrote:<br>
</div>
<blockquote type="cite">Hi guys,
<div><br>
</div>
<div>first of all, thank you for that great piece of software, it’s amazing !</div>
<div><br>
</div>
<div>Now, down to business.</div>
<div><br>
</div>
<div>When I do :</div>
<div><br>
</div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; keycloak = Keycloak.getInstance(getKeycloakServerURL(), getKeycloakRealm(), getKeycloakRealmAdminUsername(), getKeycloakRealmAdminPassword(), getKeycloakClientId());</div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; for (UserRepresentation userRepresentation : keycloak.realm(getKeycloakRealm()).users().search(null, 0, Integer.MAX_VALUE)) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://log.info" target="_blank">log.info</a>(ToStringBuilder.reflectionToString(userRepresentation, ToStringStyle.JSON_STYLE));</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
</div>
<div><br>
</div>
<div>The information I get does not contain any roles, all the roles related fields are ‘null’. -&nbsp;</div>
<div><br>
</div>
<div>{&quot;self&quot;:null,&quot;id&quot;:&quot;0556717e-ffb9-4c2d-b85b-533d9396f243&quot;,&quot;createdTimestamp&quot;:1443542144845,&quot;username&quot;:&quot;admin&quot;,&quot;enabled&quot;:true,&quot;totp&quot;:false,&quot;emailVerified&quot;:true,&quot;firstName&quot;:&quot;first name&quot;,&quot;lastName&quot;:&quot;last name&quot;,&quot;email&quot;:null,&quot;federationLink&quot;:null,&quot;serviceAccountClientId&quot;:null,&quot;attributes&quot;:{key1=[value1]},&quot;credentials&quot;:null,&quot;requiredActions&quot;:[],&quot;federatedIdentities&quot;:null,&quot;realmRoles&quot;:null,&quot;clientRoles&quot;:null,&quot;clientConsents&quot;:null,&quot;applicationRoles&quot;:null,&quot;socialLinks&quot;:null}</div>
<div>However in the admin interface I have setup roles at each layer : realm, client</div>
<div><br>
</div>
<div>The user I am using to do the queries has all the *realm* roles associated.</div>
<div><br>
</div>
<div>is there anything else I need to do ?</div>
<div><br>
</div>
<div>thank you for your help !</div>
<div><br>
<hr align="left" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px; border:0px; width:320px; min-height:1px; background-color:rgb(64,174,73)">
<p class="MsoNormal" style="color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; margin:0cm 0cm 1pt">
<br style="color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:12px; line-height:14px">
<span style="color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:12px; line-height:14px; text-transform:uppercase">REMI CARTIER</span><br style="color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:12px; line-height:14px">
</p>
<div style="color:rgb(0,0,0); font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<span style="line-height:14px"><font face="Helvetica, Arial,
                sans-serif" color="#666666">B.O.S.S. (Business &amp; Operation Support Systems) P.O (Product Owner)</font></span></div>
<br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; text-align:start; text-indent:0px; white-space:normal; word-spacing:0px; color:rgb(64,174,73); font-family:Helvetica,Arial,sans-serif; line-height:14px; text-transform:uppercase">IMETRIK
 GLOBAL INC.</strong><span style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">&nbsp;</span><br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">T
 :</strong><span style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">&nbsp;&#43;1
<a href="tel:514%20448-6407%20x2009" value="&#43;15144486407" target="_blank">514 448-6407 x2009</a></span><br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">T
 :</strong><span style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">&nbsp;&#43;1
<a href="tel:866%20276-5382" value="&#43;18662765382" target="_blank">866 276-5382</a> (toll free)&nbsp;</span><br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">F
 :</strong><span style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">&nbsp;&#43;1
<a href="tel:514%20904-0611" value="&#43;15149040611" target="_blank">514 904-0611</a>&nbsp;</span><br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<span style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">740
 Notre Dame St. West, Suite 1575&nbsp;</span><br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<span style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">Montreal,
 Quebec, Canada H3C 3X6&nbsp;</span><br style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<a href="http://www.imetrik.com/" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; color:rgb(64,174,73); font-family:Helvetica,Arial,sans-serif; line-height:14px" target="_blank">imetrik.com</a>
</div>
<br>
</div>
<br>
<fieldset target="_blank"></fieldset> <br>
<pre>_______________________________________________
keycloak-dev mailing list
<a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></pre>
</blockquote>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>