<div dir="ltr">Hello Aritz,<div><br></div><div>couldn't you just use a JWT parser library to parse the AccessToken string?</div><div><a href="http://jwt.io/">http://jwt.io/</a> lists quite a few usable ones:<br></div><div><br></div><div>I created a gist with a quick example for parsing a keycloak AccessToken with jjwt:</div><div><a href="https://gist.github.com/thomasdarimont/23a80208c1ef529169be">https://gist.github.com/thomasdarimont/23a80208c1ef529169be</a><br></div><div><br></div><div>To get the roles for a particular application (acme-petclinic) in this case, you could do the following:</div><div><pre style="color:rgb(0,0,0);font-family:'DejaVu Sans Mono';font-size:9pt">((Map<String,Object)((Map<String,Object>)claimsJws.getBody().get(<span style="color:rgb(0,128,0);font-weight:bold">"resource_access"</span>)).get(<span style="color:rgb(0,128,0);font-weight:bold">"acme-petclinic"</span>)).get(<span style="color:rgb(0,128,0);font-weight:bold">"roles"</span>)</pre></div><div><br></div><div>Cheers,</div><div>Thomas</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-07 15:53 GMT+01:00 Aritz Maeztu <span dir="ltr"><<a href="mailto:amaeztu@tesicnor.com" target="_blank">amaeztu@tesicnor.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi all,<br>
<br>
I'm managing the keycloak authentication-authorization for my
Android app. I do it manually since there's no adapter still
available as far as I know. Currently I am able to log in from a
webview, retrieve the access token using the code and refresh the
token when it's necessary and retrieve the user info using the
openid-connect compliant endpoints. However, I would like to grab
the roles available for the token too, in order to show/hide
specific operations in the screen.<br>
<br>
How to achieve it? <br>
<br>
Thanks in advance.<span class="HOEnZb"><font color="#888888"><br>
<div>-- <br>
<div>
<table style="width:600;border-collapse:collapse">
<tbody>
<tr>
<td style="border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#989898"> <span style="font-weight:bold">Aritz Maeztu OtaƱo</span><br>
<span style="font-size:12px">Departamento Desarrollo
de Software</span> </td>
<td style="border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#989898;padding-left:20px"> <a href="https://www.linkedin.com/profile/preview?vpa=pub&locale=es_ES" target="_blank">
<img src="cid:part1.03080402.07050009@tesicnor.com" border="0">
</a> </td>
</tr>
<tr>
<td> <a href="http://www.tesicnor.com" target="_blank"> <img src="cid:part3.04030705.08010007@tesicnor.com" border="0" width="143">
</a> </td>
<td style="font-size:12px">
<p style="padding-left:20px"> <span>Pol. Ind.
Mocholi.</span> <span>C/Rio Elorz, Nave 13E </span><span style="font-weight:bold">31110 Noain (Navarra)</span><br>
<span>Telf.: 948 21 40 40</span> <br>
<span>Fax.: 948 21 40 41</span> <br>
</p>
</td>
</tr>
<tr>
<td colspan="2"> <span style="color:#009900;font-size:12px">Antes de imprimir este e-mail piense bien si es
necesario hacerlo: El medioambiente es cosa de todos.</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</font></span></div>
<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" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>