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: