<div dir="ltr">Ok I found the answer by reading the question just above mine: "Obtaining the username from the security context". I did not realize that session.getToken() contained the information I need. I was checking in session.getIdToken(). <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 1:59 PM, Dean Peterson <span dir="ltr"><<a href="mailto:peterson.dean@gmail.com" target="_blank">peterson.dean@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am able to use a bearer token to call a java REST service from a pure javascript client. Unfortunately the KeycloakSecurityContext is essentially empty on the back end. I need to filter and update data by subject (idToken.subject) Initially I setup my back end REST application as a bearer token only application; thinking that was the problem, I switched to a confidential back end application but the KeycloakSecurityContext is still not populated. In order to communicate with the service in a cross domain way, I still need to send a bearer token, regardless of the type of application. I can get the subject in javascript and add it to the list of request parameters, however, it seems that leaves me open to anyone with a valid token being able to request another user's data. What is the best way to handle this kind of situation using Keycloak?</div>
</blockquote></div><br></div>