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
<
http://docs.jboss.org/keycloak/docs/1.1.0.Final/userguide/html_single/#ad...
describes the following choices: sub, preferred_username, email, name,
nickname, given_name, family_name
Alternatively, if you cast your request.getPrincipal() to KeycloakPrincipal
<
http://docs.jboss.org/keycloak/docs/1.1.0.Final/javadocs/org/keycloak/Key...;,
then you should be able to get at the various attributes via the security
context. (I think...)
Hope this helps,
Guy
On Tue, Mar 31, 2015 at 2:52 PM, Henk Laracker <
Henk.Laracker(a)planonsoftware.com> wrote:
Hi,
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
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user