<div dir="ltr">Where do you get sessionContext from?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 10, 2015 at 5:54 PM, Scott Dunbar <span dir="ltr"><<a href="mailto:scott@xigole.com" target="_blank">scott@xigole.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div 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><div><div class="h5">
<br>
<br>
<div>On 07/10/2015 04:48 PM, Juan Diego
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<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></fieldset>
<br>
</div></div><pre>_______________________________________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<div>-- <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>
</font></span></div>
<br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a 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>