Access currently authenticated user from custom realm logic

Hi,

I'm building a custom plugin with XPack and I have a custom Realm.
From the token() method (e.g. https://github.com/elastic/elasticsearch/blob/6.4/x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/realm/CustomRealm.java#L40) 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?

Thanks.
Regards.

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.

Regards,
Yogesh Gaikwad

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