<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Many thanks Thomas! I'll give it a try ;-)<br>
    <br>
    <div class="moz-cite-prefix">07/03/2016 17:16(e)an, Thomas Darimont
      igorleak idatzi zuen:<br>
    </div>
    <blockquote
cite="mid:CAK-7U1gsfJ35yu56FeH7zaDhpUJoi=odFKXasHBCTTish-kHFA@mail.gmail.com"
      type="cite">
      <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 moz-do-not-send="true" 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 moz-do-not-send="true"
            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&lt;String,Object)((Map&lt;String,Object&gt;)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">&lt;<a moz-do-not-send="true"
              href="mailto:amaeztu@tesicnor.com" target="_blank">amaeztu@tesicnor.com</a>&gt;</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 moz-do-not-send="true"
                                href="https://www.linkedin.com/profile/preview?vpa=pub&amp;locale=es_ES"
                                target="_blank"> <img
                                  src="cid:part4.02090609.05000707@tesicnor.com"
                                  border="0"> </a> </td>
                          </tr>
                          <tr>
                            <td> <a moz-do-not-send="true"
                                href="http://www.tesicnor.com"
                                target="_blank"> <img
                                  src="cid:part6.03070603.03060500@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 moz-do-not-send="true"
              href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
            <a moz-do-not-send="true"
              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>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div class="moz-signature">
        <table style="cellspadding: 0; width: 600; align: left;
          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 target="_blank"
                  href="https://www.linkedin.com/profile/preview?vpa=pub&amp;locale=es_ES">
                  <img src="cid:part10.05090903.03020405@tesicnor.com"
                    border="0">
                  <!--<img src="linkdin.gif" border="0" />--> </a> </td>
            </tr>
            <tr>
              <td> <a target="_blank" href="http://www.tesicnor.com"> <img
                    shrinktofit="true"
                    src="cid:part12.06060408.04060605@tesicnor.com"
                    border="0" width="143">
                  <!--<img shrinktofit="true" src="logo.png" width="143" border="0" />-->
                </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>
  </body>
</html>