<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Hi,</div><div><br></div><div>Well, as far as I can see, the unmarshalled AccessToken does not contain any custom attributes. I would expect something like a Map<String,Object> where you can access additional attributes.</div><div>Just to be clear: the custom attribute I configured does appear in the JWT token, I am simply searching for an easy way to access them from Java. </div><div>There is an 'otherClaims' in the JsonWebToken, should they appear there? (They don't).</div><div><br></div><div>Kind regards,</div><div>Arjan Lamers</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
What do you want for an interface? KeycloakSecurityContext has the<br>
unmarshalled IDToken and AccessToken.<br>
<br>
KeycloakPrincipal.getKeycloakSecurityContext().getToken()<br>
<br>
On 9/30/2015 11:12 AM, Arjan Lamers wrote:<br>
> Hi,<br>
><br>
> I am trying to find an easy way to access custom attributes as defined<br>
> for a client. For a Keycloak client, I?ve defined a new Mapper for a<br>
> /user attribute/ to store some additional authorisation data. This then<br>
> is managed by some user domain that uses the keycloak-admin-client to<br>
> write that property.<br>
><br>
> The problem arises when I want to access that property in an JEE<br>
> application.The way I do it right now to use the KeycloakPrincipal found<br>
> in the javax.ejb.SessionContext. From there, I get the JWT token as a<br>
> String, deserialize the JSON and access the custom attribute from there.<br>
> This feels like a very roundabout way to get to the token but somehow I<br>
> am not able to find an easier way. Is it a missing feature or is it<br>
> simply too close to the weekend for me ;)?<br><br></blockquote></div>
</div></div>