get-role-mappings.asciidoc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. [[java-rest-high-security-get-role-mappings]]
  2. === Get Role Mappings API
  3. [[java-rest-high-security-get-role-mappings-execution]]
  4. ==== Execution
  5. Retrieving a role mapping can be performed using the `security().getRoleMappings()`
  6. method and by setting role mapping name on `GetRoleMappingsRequest`:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-role-mappings-execute]
  10. --------------------------------------------------
  11. Retrieving multiple role mappings can be performed using the `security.getRoleMappings()`
  12. method and by setting role mapping names on `GetRoleMappingsRequest`:
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-role-mappings-list-execute]
  16. --------------------------------------------------
  17. Retrieving all role mappings can be performed using the `security.getRoleMappings()`
  18. method and with no role mapping name on `GetRoleMappingsRequest`:
  19. ["source","java",subs="attributes,callouts,macros"]
  20. --------------------------------------------------
  21. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-role-mappings-all-execute]
  22. --------------------------------------------------
  23. [[java-rest-high-security-get-role-mappings-response]]
  24. ==== Response
  25. The returned `GetRoleMappingsResponse` contains the list of role mapping(s).
  26. ["source","java",subs="attributes,callouts,macros"]
  27. --------------------------------------------------
  28. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-role-mappings-response]
  29. --------------------------------------------------
  30. [[java-rest-high-security-get-role-mappings-async]]
  31. ==== Asynchronous Execution
  32. This request can be executed asynchronously using the `security().getRoleMappingsAsync()`
  33. method:
  34. ["source","java",subs="attributes,callouts,macros"]
  35. --------------------------------------------------
  36. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-role-mappings-execute-async]
  37. --------------------------------------------------
  38. <1> The `GetRoleMappingsRequest` to execute and the `ActionListener` to use when
  39. the execution completes
  40. The asynchronous method does not block and returns immediately. Once the request
  41. has completed the `ActionListener` is called back using the `onResponse` method
  42. if the execution successfully completed or using the `onFailure` method if
  43. it failed.
  44. A typical listener for a `GetRoleMappingsResponse` looks like:
  45. ["source","java",subs="attributes,callouts,macros"]
  46. --------------------------------------------------
  47. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-role-mappings-execute-listener]
  48. --------------------------------------------------
  49. <1> Called when the execution is successfully completed. The response is
  50. provided as an argument
  51. <2> Called in case of failure. The raised exception is provided as an argument