[Aerogear-users] Android: How can i get user's roles from Keycloak(OAuth2 Endpoint)?

Summers Pittman supittma at redhat.com
Thu Sep 3 11:55:00 EDT 2015


On Thu, Sep 3, 2015 at 10:34 AM, Naif <nifs.arpegiuz at gmail.com> wrote:

> Hi everyone
>
> I checked the aerogear android cookbook, and i found the 'ShootAndShare'
> demo, it has interesting code in the 'KeycloakHelper.java' with some
> utility
> methods. But, i would like to know, how can i get the roles for a
> registered
> keycloak user?
>
> Are the AuthorizationManager and AuthzModule the right classes for this
> task? Or, it is better to use another approach? Because, it would be
> necessary to retrieve more user information from Keycloak(i.e. user email,
> first name, etc) and to code a correct logout method.
>
> Any ideas?
>

The authz librares are mostly used to managing OAuth2 tokens and
lifecycles.  One could modify the classes in the oauth2 package to handle
keycloak events.  I would begin looking at Oauth2Session and
Oauth2AuthzService.  The session class would add properties available from
KeyCloak and the OAuth2AuthzService class would fetch these properties as
part of the login lifecycle.  Everything else would probably remain
relatively untouched.

This sounds like an amazing opportunity for some refactoring or adding
pluggability to the lifecycle.

TL;DR; yes those are good interfaces to look at.




>
> Thanks in advance.
>
>
>
>
>
> --
> View this message in context:
> http://aerogear-users.1116366.n5.nabble.com/Android-How-can-i-get-user-s-roles-from-Keycloak-OAuth2-Endpoint-tp230.html
> Sent from the aerogear-users mailing list archive at Nabble.com.
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20150903/1b1873e9/attachment.html 


More information about the Aerogear-users mailing list