Activate a user profile
Generally available; Added in 8.2.0
Create or update a user profile on behalf of another user.
NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
Individual users and external applications should not call this API directly.
The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for.
Elastic reserves the right to change or remove this feature in future releases without prior notice.
This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm.
For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token.
When updating a profile document, the API enables the document if it was disabled.
Any updates do not change existing content for either the labels or data fields.
Required authorization
- Cluster privileges:
manage_user_profile
Body
Required
-
The user's Elasticsearch access token or JWT. Both
accessandidJWT token types are supported and they depend on the underlying JWT realm configuration. If you specify theaccess_tokengrant type, this parameter is required. It is not valid with other grant types. -
The type of grant.
Supported values include:
password: In this type of grant, you must supply the user ID and password for which you want to create the API key.access_token: In this type of grant, you must supply an access token that was created by the Elasticsearch token service. If you are activating a user profile, you can alternatively supply a JWT (either a JWTaccess_tokenor a JWTid_token).
Values are
passwordoraccess_token. -
The user's password. If you specify the
passwordgrant type, this parameter is required. It is not valid with other grant types. -
The username that identifies the user. If you specify the
passwordgrant type, this parameter is required. It is not valid with other grant types.
POST /_security/profile/_activate
{
"grant_type": "password",
"username" : "jacknich",
"password" : "l0ng-r4nd0m-p@ssw0rd"
}
resp = client.security.activate_user_profile(
grant_type="password",
username="jacknich",
password="l0ng-r4nd0m-p@ssw0rd",
)
const response = await client.security.activateUserProfile({
grant_type: "password",
username: "jacknich",
password: "l0ng-r4nd0m-p@ssw0rd",
});
response = client.security.activate_user_profile(
body: {
"grant_type": "password",
"username": "jacknich",
"password": "l0ng-r4nd0m-p@ssw0rd"
}
)
$resp = $client->security()->activateUserProfile([
"body" => [
"grant_type" => "password",
"username" => "jacknich",
"password" => "l0ng-r4nd0m-p@ssw0rd",
],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"grant_type":"password","username":"jacknich","password":"l0ng-r4nd0m-p@ssw0rd"}' "$ELASTICSEARCH_URL/_security/profile/_activate"
client.security().activateUserProfile(a -> a
.grantType(GrantType.Password)
.password("l0ng-r4nd0m-p@ssw0rd")
.username("jacknich")
);
{
"grant_type": "password",
"username" : "jacknich",
"password" : "l0ng-r4nd0m-p@ssw0rd"
}
{
"uid": "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
"enabled": true,
"last_synchronized": 1642650651037,
"user": {
"username": "jacknich",
"roles": [
"admin", "other_role1"
],
"realm_name": "native",
"full_name": "Jack Nicholson",
"email": "jacknich@example.com"
},
"labels": {},
"data": {},
"_doc": {
"_primary_term": 88,
"_seq_no": 66
}
}