<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 bgcolor="#FFFFFF" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;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: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF325994" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Marek Posolda [mposolda@redhat.com]<br>
<b>Sent:</b> Wednesday, September 30, 2015 6:21 AM<br>
<b>To:</b> Remi Cartier; keycloak-dev@lists.jboss.org<br>
<b>Subject:</b> Re: [keycloak-dev] Admin REST - User Roles<br>
</font><br>
</div>
<div></div>
<div>
<div class="moz-cite-prefix">Hi,<br>
<br>
to retrieve realm role mappings of user, you need to use the endpoint like <a class="moz-txt-link-freetext" 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 class="moz-txt-link-freetext" 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 class=""><br class="">
</div>
<div class="">first of all, thank you for that great piece of software, it’s amazing !</div>
<div class=""><br class="">
</div>
<div class="">Now, down to business.</div>
<div class=""><br class="">
</div>
<div class="">When I do :</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""> keycloak = Keycloak.getInstance(getKeycloakServerURL(), getKeycloakRealm(), getKeycloakRealmAdminUsername(), getKeycloakRealmAdminPassword(), getKeycloakClientId());</div>
<div class="">
<div class=""> for (UserRepresentation userRepresentation : keycloak.realm(getKeycloakRealm()).users().search(null, 0, Integer.MAX_VALUE)) {</div>
<div class=""> log.info(ToStringBuilder.reflectionToString(userRepresentation, ToStringStyle.JSON_STYLE));</div>
<div class=""> }</div>
</div>
<div class=""><br class="">
</div>
<div class="">The information I get does not contain any roles, all the roles related fields are ‘null’. - </div>
<div class=""><br class="">
</div>
<div class="">{"self":null,"id":"0556717e-ffb9-4c2d-b85b-533d9396f243","createdTimestamp":1443542144845,"username":"admin","enabled":true,"totp":false,"emailVerified":true,"firstName":"first name","lastName":"last name","email":null,"federationLink":null,"serviceAccountClientId":null,"attributes":{key1=[value1]},"credentials":null,"requiredActions":[],"federatedIdentities":null,"realmRoles":null,"clientRoles":null,"clientConsents":null,"applicationRoles":null,"socialLinks":null}</div>
<div class="">However in the admin interface I have setup roles at each layer : realm, client</div>
<div class=""><br class="">
</div>
<div class="">The user I am using to do the queries has all the *realm* roles associated.</div>
<div class=""><br class="">
</div>
<div class="">is there anything else I need to do ?</div>
<div class=""><br class="">
</div>
<div class="">thank you for your help !</div>
<div class=""><br class="Apple-interchange-newline">
<hr class="" align="left" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px; border:0px; width:320px; 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; orphans:2; widows:2; margin:0cm 0cm 1pt">
<br class="" style="color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:12px; line-height:14px; orphans:auto; widows:auto">
<span class="" style="color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:12px; line-height:14px; orphans:auto; widows:auto; text-transform:uppercase">REMI CARTIER</span><br class="" style="color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; font-size:12px; line-height:14px; orphans:auto; widows:auto">
</p>
<div class="" 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; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<span class="" style="line-height:14px"><font class="" face="Helvetica, Arial,
sans-serif" color="#666666">B.O.S.S. (Business & Operation Support Systems) P.O (Product Owner)</font></span></div>
<br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong class="" style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; white-space:normal; widows:auto; 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 class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px"> </span><br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong class="" style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">T
:</strong><span class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px"> +1
514 448-6407 x2009</span><br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong class="" style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">T
:</strong><span class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px"> +1
866 276-5382 (toll free) </span><br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<strong class="" style="font-size:12px; font-style:normal; font-variant:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">F
:</strong><span class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px"> +1
514 904-0611 </span><br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<span class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">740
Notre Dame St. West, Suite 1575 </span><br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<span class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">Montreal,
Quebec, Canada H3C 3X6 </span><br class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(102,102,102); font-family:Helvetica,Arial,sans-serif; line-height:14px">
<a href="http://www.imetrik.com/" class="" style="font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; color:rgb(64,174,73); font-family:Helvetica,Arial,sans-serif; line-height:14px" target="_blank">imetrik.com</a>
</div>
<br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader" target="_blank"></fieldset> <br>
<pre>_______________________________________________
keycloak-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" 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>
</body>
</html>