[keycloak-user] Get the user of the current request from the KeycloakSession?

Erik Mulder erik.mulder at docdatapayments.com
Wed Dec 16 09:37:22 EST 2015


Seems like a simple scenario, but I can't figure it out: I have an
instance of the KeycloakSession and I want to get the UserModel for the
current request. Is this possible?

Context: I'm creating a custom REST service that runs inside keycloak
and needs to get some data that is related to the current authenticated
user. For instance the realm and client I can get through the
session.getContext().getClient/Realm(). I would expect a getUser() there
too, but I can't find it anywhere 'in' the session.

If this isn't possible, shouldn't it be? Or if not, why not?



More information about the keycloak-user mailing list