[keycloak-user] Get current user through JACC

Luca Stancapiano luca.stancapiano at vige.it
Mon Nov 19 04:06:07 EST 2018


I'm testing a javaee webapp inside a Wildfly with a 4.5.0.Final keycloak adapter installed. The authentication is ok but now I would get in my web app the current user id.

Using this code:

javax.security.jacc.PolicyContext.getContext("javax.security.auth.Subject.container");

I get null. How I miss to receive the user id?

You can test the sample of the keycloak quickstart from https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-authz-jee-vanilla and add that code in the Controller class where do you want.


More information about the keycloak-user mailing list