2017-06-28 14:02:40 -04:00
|
|
|
[role="xpack"]
|
2017-04-06 21:04:39 -04:00
|
|
|
[[security-api-change-password]]
|
2018-08-18 02:17:33 -04:00
|
|
|
=== Change passwords API
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2018-08-18 02:17:33 -04:00
|
|
|
Changes the passwords of users in the native realm.
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2017-09-22 13:00:04 -04:00
|
|
|
==== Request
|
|
|
|
|
|
|
|
`POST _xpack/security/user/_password` +
|
2017-09-22 13:01:49 -04:00
|
|
|
|
|
|
|
`POST _xpack/security/user/<username>/_password`
|
2017-09-22 13:00:04 -04:00
|
|
|
|
|
|
|
|
2018-08-18 02:17:33 -04:00
|
|
|
==== Description
|
|
|
|
|
|
|
|
You can use the <<security-api-put-user,create user API>> to update everything
|
|
|
|
but a user's `username` and `password`. This API changes a user's password.
|
|
|
|
|
|
|
|
For more information about the native realm, see
|
|
|
|
{stack-ov}/realms.html[Realms] and <<configuring-native-realm>>.
|
|
|
|
|
|
|
|
|
2017-09-22 13:00:04 -04:00
|
|
|
==== Path Parameters
|
|
|
|
|
|
|
|
`username`::
|
|
|
|
(string) The user whose password you want to change. If you do not specify
|
|
|
|
this parameter, the password is changed for the current user.
|
|
|
|
|
|
|
|
|
|
|
|
==== Request Body
|
|
|
|
|
|
|
|
`password` (required)::
|
|
|
|
(string) The new password value.
|
|
|
|
|
|
|
|
|
|
|
|
==== Authorization
|
|
|
|
|
|
|
|
Every user can change their own password. Users with the `manage_security`
|
|
|
|
privilege can change passwords of other users.
|
|
|
|
|
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
2018-08-18 02:17:33 -04:00
|
|
|
The following example updates the password for the `jacknich` user:
|
2017-04-06 21:04:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-08-18 02:17:33 -04:00
|
|
|
POST /_xpack/security/user/jacknich/_password
|
2017-04-06 21:04:39 -04:00
|
|
|
{
|
2018-08-18 02:17:33 -04:00
|
|
|
"password" : "s3cr3t"
|
2017-04-06 21:04:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
2018-08-18 02:17:33 -04:00
|
|
|
// TEST[setup:jacknich_user]
|
2017-04-06 21:04:39 -04:00
|
|
|
|
|
|
|
A successful call returns an empty JSON structure.
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE
|