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:

((KeycloakPrincipal)getUserPrincipal()).getKeycloakSecurityContext().getToken().getPreferredUsername()

this should also work on older versions, but your code may need to have dependencies on keycloak.

Marek

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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user