[keycloak-user] How to Pass User Attributes on Bearer Only Application?

Carlos Feria carlosthe19916 at gmail.com
Tue Nov 8 14:10:08 EST 2016


Hi all. I have an Angular2 application(frontend) and a Restful(jax-rs) for
rest services. My Angular2 application has a *Public Client* Configuration
and my Rest Services has a* Bearer Only* Client Configuration. I'm trying
to get user attributes using this code:


HttpServletRequest request = servletRequest.get(); org.keycloak.
KeycloakPrincipal kcPrincipal = (org.keycloak.KeycloakPrincipal) request.
getUserPrincipal();
org.keycloak.representations.AccessToken accessToken = kcPrincipal.
getKeycloakSecurityContext().getToken();
Map<String, Object> otherClaims = accessToken.getOtherClaims();



The problem is that accessToken.getOtherClaims() doesn't return any data. *I
think that this happens because my rest application is BEARER ONLY*, but
i'm not sure.

Please help me, *I need to pass data using user attributes (Employe
Department for example). How could I solve my problem?*


*Thank you very much!!!*

-- 
Carlos E. Feria Vila


More information about the keycloak-user mailing list