2018-11-26 23:07:24 -05:00
|
|
|
--
|
|
|
|
:api: put-user
|
|
|
|
:request: PutUserRequest
|
|
|
|
:response: PutUserResponse
|
|
|
|
--
|
2019-09-11 16:19:13 -04:00
|
|
|
[role="xpack"]
|
2018-11-26 23:07:24 -05:00
|
|
|
[id="{upid}-{api}"]
|
2018-09-07 13:51:37 -04:00
|
|
|
=== Put User API
|
2018-09-05 12:56:30 -04:00
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
[id="{upid}-{api}-request"]
|
|
|
|
==== Put User Request Request
|
|
|
|
|
|
|
|
The +{request}+ class is used to create or update a user in the Native Realm.
|
|
|
|
There are 3 different factory methods for creating a request.
|
2018-09-05 12:56:30 -04:00
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
===== Create or Update User with a Password
|
|
|
|
|
|
|
|
If you wish to create a new user (or update an existing user) and directly specifying the user's new password, use the
|
|
|
|
`withPassword` method as shown below:
|
2018-09-05 12:56:30 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-26 23:07:24 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-password-request]
|
2018-09-05 12:56:30 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
===== Create or Update User with a Hashed Password
|
2018-09-05 12:56:30 -04:00
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
If you wish to create a new user (or update an existing user) and perform password hashing on the client,
|
|
|
|
then use the `withPasswordHash` method:
|
2018-09-05 12:56:30 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-26 23:07:24 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-hash-request]
|
2018-09-05 12:56:30 -04:00
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
===== Update a User without changing their password
|
2018-09-05 12:56:30 -04:00
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
If you wish to update an existing user, and do not wish to change the user's password,
|
|
|
|
then use the `updateUserProperties` method:
|
2018-09-05 12:56:30 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-26 23:07:24 -05:00
|
|
|
include-tagged::{doc-tests-file}[{api}-update-request]
|
2018-09-05 12:56:30 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
include::../execution.asciidoc[]
|
2018-09-05 12:56:30 -04:00
|
|
|
|
2018-11-26 23:07:24 -05:00
|
|
|
[id="{upid}-{api}-response"]
|
|
|
|
==== Put User Response
|
|
|
|
|
|
|
|
The returned `PutUserResponse` contains a single field, `created`. This field
|
|
|
|
serves as an indication if a user was created or if an existing entry was updated.
|
2018-09-05 12:56:30 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-11-26 23:07:24 -05:00
|
|
|
include-tagged::{doc-tests}/SecurityDocumentationIT.java[put-user-response]
|
2018-09-05 12:56:30 -04:00
|
|
|
--------------------------------------------------
|
2018-11-26 23:07:24 -05:00
|
|
|
<1> `created` is a boolean indicating whether the user was created or updated
|