Access currently authenticated user from custom realm logic


I'm building a custom plugin with XPack and I have a custom Realm.
From the token() method (e.g. I would like to access the authenticated user like if I would run:

GET _xpack/security/_authenticate

is that possible to do that programmatically there?


Hi @Guiss39,

If you look at the documentation for token() you will see that this method is responsible
for extracting the authentication token from the request. So at this point, the authentication
is still in progress and there is no information regarding User and its role.

Could you please give us some details as to what you are trying to do? so we can help you better.

Yogesh Gaikwad

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.