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
|
2018-12-20 13:23:28 -05:00
|
|
|
++++
|
|
|
|
<titleabbrev>Change passwords</titleabbrev>
|
|
|
|
++++
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2019-07-31 10:54:00 -04:00
|
|
|
Changes the passwords of users in the native realm and built-in users.
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-change-password-request]]
|
|
|
|
==== {api-request-title}
|
2017-09-22 13:00:04 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`POST /_security/user/_password` +
|
2017-09-22 13:01:49 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`POST /_security/user/<username>/_password`
|
2017-09-22 13:00:04 -04:00
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-change-password-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* Every user can change their own password. Users with the `manage_security`
|
|
|
|
privilege can change passwords of other users.
|
|
|
|
|
|
|
|
[[security-api-change-password-desc]]
|
|
|
|
==== {api-description-title}
|
2018-08-18 02:17:33 -04:00
|
|
|
|
|
|
|
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>>.
|
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-change-password-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
2017-09-22 13:00:04 -04:00
|
|
|
|
|
|
|
`username`::
|
2019-08-02 13:56:05 -04:00
|
|
|
(Optional, string) The user whose password you want to change. If you do not specify
|
2017-09-22 13:00:04 -04:00
|
|
|
this parameter, the password is changed for the current user.
|
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-change-password-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2017-09-22 13:00:04 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
`password`::
|
|
|
|
(Required, string) The new password value.
|
2017-09-22 13:00:04 -04:00
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-change-password-example]]
|
|
|
|
==== {api-examples-title}
|
2017-09-22 13:00:04 -04:00
|
|
|
|
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
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
POST /_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
|
|
|
}
|
|
|
|
--------------------------------------------------
|
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.
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console-result]
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{}
|
|
|
|
--------------------------------------------------
|