<div dir="ltr">By default it returns the UUID for the user. So in Tomcat you are seeing the default behavior, while on WildFly you are seeing the behavior if principal-attribute is set to principal-attribute in keycloak.json. See <a href="http://keycloak.github.io/docs/userguide/keycloak-server/html/ch08.html#adapter-config">http://keycloak.github.io/docs/userguide/keycloak-server/html/ch08.html#adapter-config</a><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 May 2016 at 20:07, Marc Savy <span dir="ltr">&lt;<a href="mailto:marc.savy@redhat.com" target="_blank">marc.savy@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
I&#39;ve been setting up apiman&#39;s quickstart tomcat8 distro with Keycloak<br>
(rather than using the inbuilt auth).<br>
<br>
I&#39;ve managed to get everything working swimmingly, with one strange issue:<br>
<br>
HttpServletRequest#getRemoteUser()<br>
<br>
- On WildFly, this code[1] returns the preferred_username (e.g.<br>
admin). Expected behaviour.<br>
<br>
- On Tomcat8 it return the subject[2] (e.g.<br>
5291684c-225a-4b3d-8795-15486feaf2ae)<br>
<br>
I think the problem might stem from where the principal is being built:<br>
<br>
  <a href="https://github.com/keycloak/keycloak/blob/master/adapters/spi/tomcat-adapter-spi/src/main/java/org/keycloak/adapters/tomcat/GenericPrincipalFactory.java#L39" rel="noreferrer" target="_blank">https://github.com/keycloak/keycloak/blob/master/adapters/spi/tomcat-adapter-spi/src/main/java/org/keycloak/adapters/tomcat/GenericPrincipalFactory.java#L39</a><br>
<br>
Are we misusing #getRemoteUser, or is there an error in the adapter?<br>
<br>
Regards,<br>
Marc<br>
<br>
[1] <a href="https://github.com/apiman/apiman/blob/master/manager/ui/war/src/main/java/io/apiman/manager/ui/server/servlets/ConfigurationServlet.java#L105" rel="noreferrer" target="_blank">https://github.com/apiman/apiman/blob/master/manager/ui/war/src/main/java/io/apiman/manager/ui/server/servlets/ConfigurationServlet.java#L105</a><br>
[2] &#39;id&#39; in UI<br>
_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
</blockquote></div><br></div>