Hi Henk,

In your adapter configuration file, probably keycloak.json in your war's WEB-INF folder, add the following configuration:

"principal-attribute": "preferred_username"

The docs describes the following choices:  sub, preferred_username, email, name, nickname, given_name, family_name

Alternatively, if you cast your request.getPrincipal() to KeycloakPrincipal, then you should be able to get at the various attributes via the security context. (I think...)

Hope this helps,

On Tue, Mar 31, 2015 at 2:52 PM, Henk Laracker <Henk.Laracker@planonsoftware.com> wrote:

I’m using the key cloak tomcat 7 adaptor, I created a sample application which works fine with keycloak. I created a jsp page with the following code

   String username = request.getRemoteUser();
   <tr><td>User</td><td><%= username %></td></tr> 

 I have logged in with the username : supervisor 

So I expect the username to be : supervisor

But the result is :3d5bfb0c-9495-48b8-a11c-2e83097b2f39

What do I do wrong ? 

Met vriendelijke groet / Yours sincerely / Mit freundlichen Grüßen / Très cordialement,

Henk Laracker

keycloak-user mailing list