WARNING: Version 5.5 of the Elastic Stack has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Submitting Requests on Behalf of Other Users
editSubmitting Requests on Behalf of Other Users
editX-Pack security supports a permission that enables an authenticated user to submit requests on behalf of other users. If your application already authenticates users, you can use the run as mechanism to restrict data access according to X-Pack security permissions without having to re-authenticate each user through.
To "run as" (impersonate) another user, you must be able to retrieve the user from
the realm you use to authenticate. Both the internal native
and file
realms
support this out of the box. The LDAP realm however must be configured to run in
user search mode. For more information, see
Configuring an LDAP Realm with User Search.
The Active Directory and PKI realms do not support "run as".
To submit requests on behalf of other users, you need to have the run_as
permission. For example, the following role grants permission to submit request
on behalf of jacknich
or redeniro
:
{ "run_as" : [ "jacknich", "rdeniro" ] }
To submit a request as another user, you specify the user in the
es-security-runas-user
request header. For example:
curl -H "es-security-runas-user: jacknich" -u es_admin -XGET 'http://localhost:9200/'