<div dir="ltr">Hi Henk,<div><br>In your adapter configuration file, probably keycloak.json in your war's WEB-INF folder, add the following configuration:<br><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px">"principal-attribute": "preferred_username"</blockquote><br>The <a href="http://docs.jboss.org/keycloak/docs/1.1.0.Final/userguide/html_single/#adapter-config">docs</a> describes the following choices: sub, preferred_username, email, name, nickname, given_name, family_name<br><br>Alternatively, if you cast your request.getPrincipal() to <a href="http://docs.jboss.org/keycloak/docs/1.1.0.Final/javadocs/org/keycloak/KeycloakPrincipal.html">KeycloakPrincipal</a>, then you should be able to get at the various attributes via the security context. (I think...)<div><br></div><div>Hope this helps,</div><div>Guy<br><div><code class="" style="font-size:0.9em;font-family:courrier,monospace;white-space:nowrap;color:rgb(51,51,51);line-height:18px;text-align:justify"><br></code></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 31, 2015 at 2:52 PM, Henk Laracker <span dir="ltr"><<a href="mailto:Henk.Laracker@planonsoftware.com" target="_blank">Henk.Laracker@planonsoftware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><div>Hi,</div><div><br></div><div>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</div><div><br></div><div><div> String username = request.getRemoteUser();</div><div> <tr><td>User</td><td><%= username %></td></tr> </div></div><div><br></div><div><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><span lang="NL"> I have logged in with the username : supervisor </span></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><span lang="NL">So I expect the username to be : supervisor</span></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt">But the result is :<span style="color:rgb(0,128,0);font-family:Times;font-size:medium;background-color:rgb(0,0,0)">3d5bfb0c-9495-48b8-a11c-2e83097b2f39</span></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><span lang="NL"><br></span></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt">What do I do wrong ? </p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><span lang="NL"><br></span></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><span lang="NL">Met vriendelijke groet / Yours sincerely / Mit freundlichen Grüßen / Très cordialement,<u></u><u></u></span></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><br></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt">Henk Laracker<u></u><u></u></p><p class="MsoNormal" style="font-size:11pt;margin:0cm 0cm 0.0001pt"><br></p></div></div>
<br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>