disable-user.asciidoc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. [role="xpack"]
  2. [[java-rest-high-security-disable-user]]
  3. === Disable User API
  4. [[java-rest-high-security-disable-user-execution]]
  5. ==== Execution
  6. Disabling a user can be performed using the `security().disableUser()`
  7. method:
  8. ["source","java",subs="attributes,callouts,macros"]
  9. --------------------------------------------------
  10. include-tagged::{doc-tests}/SecurityDocumentationIT.java[disable-user-execute]
  11. --------------------------------------------------
  12. [[java-rest-high-security-disable-user-response]]
  13. ==== Response
  14. The returned `Boolean` indicates the request status.
  15. [[java-rest-high-security-disable-user-async]]
  16. ==== Asynchronous Execution
  17. This request can be executed asynchronously:
  18. ["source","java",subs="attributes,callouts,macros"]
  19. --------------------------------------------------
  20. include-tagged::{doc-tests}/SecurityDocumentationIT.java[disable-user-execute-async]
  21. --------------------------------------------------
  22. <1> The `DisableUser` request to execute and the `ActionListener` to use when
  23. the execution completes.
  24. The asynchronous method does not block and returns immediately. Once the request
  25. has completed the `ActionListener` is called back using the `onResponse` method
  26. if the execution successfully completed or using the `onFailure` method if
  27. it failed.
  28. A typical listener for a `Boolean` looks like:
  29. ["source","java",subs="attributes,callouts,macros"]
  30. --------------------------------------------------
  31. include-tagged::{doc-tests}/SecurityDocumentationIT.java[disable-user-execute-listener]
  32. --------------------------------------------------
  33. <1> Called when the execution is successfully completed. The response is
  34. provided as an argument.
  35. <2> Called in case of failure. The raised exception is provided as an argument.