[keycloak-user] Obtaining the user name from the security context
gbrown at redhat.com
Thu Nov 20 05:25:22 EST 2014
Thanks for the information.
However, I've tried it without success - I also tried using this attribute in the keycloak unconfigured-demo and preconfigured-demo examples for customer-app/product-app, and didn't have an effect on them either.
Just wondering whether the text in the doc "OpenID Connection ID Token attribute to populate the UserPrincipal name with" implies that this attribute only works for OpenID?
With the unconfigured version, it wasn't clear whether this attribute would be set under the realm or secure-deployment elements, so initially I tried just under the realm but then eventually defined the attribute under both. Attached the wildfly standalone-full.xml.
----- Original Message -----
> If you have 1.1.0.Beta1, you can try to use "principal-attribute" with
> value "|preferred_username" in the configuration of your adapter. More
> info in |http://docs.jboss.org/keycloak/docs/1.1.0.Beta1/userguide
> /html/ch07.html#adapter-config .
> It should also work to cast getUserPrincipal() to KeycloakPrincipal and
> use something like:
> this should also work on older versions, but your code may need to have
> dependencies on keycloak.
> On 19.11.2014 17:20, Gary Brown wrote:
> > Hi
> > When I access getUserPrincipal().getName() in
> > javax.ws.rs.core.SecurityContext I get the UID.
> > Is it possible to obtain the actual user name?
> > Regards
> > Gary
> > _______________________________________________
> > keycloak-user mailing list
> > keycloak-user at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-user
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 30314 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20141120/8ccc4011/attachment-0001.rdf
More information about the keycloak-user