saml-logout-api.asciidoc 2.8 KB

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