<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">If you don't want Keycloak
      dependencies, you can use request.getRemoteUser() or
      request.getPrincipal().getName() to access just the userId of
      authenticated user. If you use "principal-attribute" in
      keycloak.json, it will return the configured attribute instead of
      userId, so you can receive for example username or email instead.
      But that way, you will be able to access just this single
      attribute.<br>
      <br>
      Marek<br>
      <br>
      On 26/10/15 09:52, Tim Dudgeon wrote:<br>
    </div>
    <blockquote cite="mid:562DE9BA.9030703@gmail.com" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      Wondered if anyone had any thoughts on this?<br>
      <br>
      <div class="moz-cite-prefix">On 21/10/2015 12:04, Tim Dudgeon
        wrote:<br>
      </div>
      <blockquote cite="mid:5627712F.4040200@gmail.com" type="cite">
        <meta http-equiv="content-type" content="text/html;
          charset=windows-1252">
        In the case of a web application (e.g. Tomcat app secured by the
        keycloak adapter) the web app might need to access details of
        the authenticated user (e.g. full name or email).<br>
        I've found that this information is available from the session
        like this: <br>
        <br>
        <small><tt>KeycloakSecurityContext session =
(KeycloakSecurityContext)request.getAttribute(KeycloakSecurityContext.class.getName());</tt><tt><br>
          </tt><tt>IDToken idToken = session.getIdToken();</tt><tt><br>
          </tt><tt>String email = idToken.getEmail();</tt></small><br>
        <br>
        One issue with this is that all your web apps are tied to
        keycloak.<br>
        <br>
        Is this the right way to handle this?<br>
        Are there alternatives?<br>
        <br>
        Tim<br>
        <br>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
keycloak-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
    </blockquote>
    <br>
  </body>
</html>