saml-logout-api.asciidoc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [role="xpack"]
  2. [[security-api-saml-logout]]
  3. === SAML logout API
  4. ++++
  5. <titleabbrev>SAML logout</titleabbrev>
  6. ++++
  7. Submits a request to invalidate an access token and refresh token.
  8. NOTE: This API is intended for use by custom web applications other than {kib}.
  9. If you are using {kib}, see the <<saml-guide>>.
  10. [[security-api-saml-logout-request]]
  11. ==== {api-request-title}
  12. `POST /_security/saml/logout`
  13. [[security-api-saml-logout-desc]]
  14. ==== {api-description-title}
  15. This API invalidates the tokens that were generated for a user by the
  16. <<security-api-saml-authenticate,SAML authenticate API>>.
  17. If the SAML realm in {es} is configured accordingly and the SAML IdP supports
  18. this, the {es} response contains a URL to redirect the user to the IdP
  19. that contains a SAML logout request (starting an SP-initiated SAML Single Logout).
  20. {es} exposes all the necessary SAML related functionality via the SAML APIs.
  21. These APIs are used internally by {kib} in order to provide SAML based
  22. authentication, but can also be used by other custom web applications or other
  23. clients. See also <<security-api-saml-authenticate,SAML authenticate API>>,
  24. <<security-api-saml-prepare-authentication,SAML prepare authentication API>>,
  25. and <<security-api-saml-invalidate,SAML invalidate API>>.
  26. [[security-api-saml-logout-request-body]]
  27. ==== {api-request-body-title}
  28. `token`::
  29. (Required, string) The access token that was returned as a response to calling the
  30. <<security-api-saml-authenticate,SAML authenticate API>>. Alternatively, the most
  31. recent token that was received after refreshing the original one by using a
  32. `refresh_token`.
  33. `refresh_token`::
  34. (Optional, string) The refresh token that was returned as a response to calling the
  35. <<security-api-saml-authenticate,SAML authenticate API>>. Alternatively, the
  36. most recent refresh token that was received after refreshing the original access token.
  37. [[security-api-saml-logout-response-body]]
  38. ==== {api-response-body-title}
  39. `redirect`::
  40. (string) A URL that contains a SAML logout request as a parameter. The user
  41. can use this URL to be redirected back to the SAML IdP and to initiate Single
  42. Logout.
  43. [[security-api-saml-logout-example]]
  44. ==== {api-examples-title}
  45. The following example invalidates the pair of tokens that were generated by
  46. calling the <<security-api-saml-authenticate,SAML authenticate API>>
  47. with a successful SAML response:
  48. [source,console]
  49. --------------------------------------------------
  50. POST /_security/saml/logout
  51. {
  52. "token" : "46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3",
  53. "refresh_token" : "mJdXLtmvTUSpoLwMvdBt_w"
  54. }
  55. --------------------------------------------------
  56. // TEST[skip:can't test this without a valid SAML Response]
  57. The API returns the following response:
  58. [source,js]
  59. --------------------------------------------------
  60. {
  61. "redirect" : "https://my-idp.org/logout/SAMLRequest=...."
  62. }
  63. --------------------------------------------------
  64. // NOTCONSOLE