<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I use something like:<br>
<br>
<pre>import org.keycloak.KeycloakPrincipal;
import org.keycloak.KeycloakSecurityContext;
import org.keycloak.representations.IDToken;
...
@Resource
private SessionContext sessionContext;
...
@SuppressWarnings("unchecked")
KeycloakPrincipal<KeycloakSecurityContext> kcPrincipal = (KeycloakPrincipal<KeycloakSecurityContext>)(sessionContext.getCallerPrincipal());
IDToken idToken = kcPrincipal.getKeycloakSecurityContext().getIdToken();
log.debug( "email from token is \"" + idToken.getEmail() + "\"" );</pre>
<br>
Not sure if that's the recommended way but it works well. <br>
<br>
<br>
<div class="moz-cite-prefix">On 07/10/2015 04:48 PM, Juan Diego
wrote:<br>
</div>
<blockquote
cite="mid:CAJGEj6dzN_LYWZQ6A81zL7-1uG-GvHOzXRrUhXOOsYfHK6MBsw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>Hi<br>
<br>
</div>
I want to be able to update the user password and some
preferences from my web app, in order to update some of
the user info from my portal i can see in the rest api
that you need the user ID. <br>
</div>
I have a backend with java that should connect to my
keycloak server once it gets the token<br>
<br>
KeycloakSecurityContext securityContext =
(KeycloakSecurityContext) httpRequest<br>
.getAttribute(KeycloakSecurityContext.class.getName());<br>
<br>
AccessToken accessToken = securityContext.getToken();<br>
<br>
</div>
I dont know how to get info from the accesToken, or does the
access token class already has methods to do that. I know
this is more of a question of design. This part is not really
clear for me.<br>
<br>
</div>
Thanks<br>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
keycloak-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<span style="font-weight: bold">Scott Dunbar</span><br>
<span>Xigole Systems, Inc.</span><br>
<span>Enterprise consulting, development, and hosting</span><br>
<span>303·667·6343</span><br>
</div>
</body>
</html>