[keycloak-user] Accessing authenticated user's details

Tim Dudgeon tdudgeon.ml at gmail.com
Wed Oct 21 07:04:15 EDT 2015


In the case of a web application (e.g. Tomcat app secured by the 
keycloak adapter) the web app might need to access details of the 
authenticated user (e.g. full name or email).
I've found that this information is available from the session like this:

KeycloakSecurityContext session = 
(KeycloakSecurityContext)request.getAttribute(KeycloakSecurityContext.class.getName());
IDToken idToken = session.getIdToken();
String email = idToken.getEmail();

One issue with this is that all your web apps are tied to keycloak.

Is this the right way to handle this?
Are there alternatives?

Tim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151021/8a3db56a/attachment.html 


More information about the keycloak-user mailing list