put-user.asciidoc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --
  2. :api: put-user
  3. :request: PutUserRequest
  4. :response: PutUserResponse
  5. --
  6. [id="{upid}-{api}"]
  7. === Put User API
  8. [id="{upid}-{api}-request"]
  9. ==== Put User Request Request
  10. The +{request}+ class is used to create or update a user in the Native Realm.
  11. There are 3 different factory methods for creating a request.
  12. ===== Create or Update User with a Password
  13. If you wish to create a new user (or update an existing user) and directly specifying the user's new password, use the
  14. `withPassword` method as shown below:
  15. ["source","java",subs="attributes,callouts,macros"]
  16. --------------------------------------------------
  17. include-tagged::{doc-tests-file}[{api}-password-request]
  18. --------------------------------------------------
  19. ===== Create or Update User with a Hashed Password
  20. If you wish to create a new user (or update an existing user) and perform password hashing on the client,
  21. then use the `withPasswordHash` method:
  22. ["source","java",subs="attributes,callouts,macros"]
  23. --------------------------------------------------
  24. include-tagged::{doc-tests-file}[{api}-hash-request]
  25. --------------------------------------------------
  26. ===== Update a User without changing their password
  27. If you wish to update an existing user, and do not wish to change the user's password,
  28. then use the `updateUserProperties` method:
  29. ["source","java",subs="attributes,callouts,macros"]
  30. --------------------------------------------------
  31. include-tagged::{doc-tests-file}[{api}-update-request]
  32. --------------------------------------------------
  33. include::../execution.asciidoc[]
  34. [id="{upid}-{api}-response"]
  35. ==== Put User Response
  36. The returned `PutUserResponse` contains a single field, `created`. This field
  37. serves as an indication if a user was created or if an existing entry was updated.
  38. ["source","java",subs="attributes,callouts,macros"]
  39. --------------------------------------------------
  40. include-tagged::{doc-tests}/SecurityDocumentationIT.java[put-user-response]
  41. --------------------------------------------------
  42. <1> `created` is a boolean indicating whether the user was created or updated