saml-logout-api.asciidoc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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-stack>>.
  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. <<security-api-saml-invalidate,SAML invalidate API>>, and
  26. <<security-api-saml-complete-logout, SAML complete logout API>>.
  27. [[security-api-saml-logout-request-body]]
  28. ==== {api-request-body-title}
  29. `token`::
  30. (Required, string) The access token that was returned as a response to calling the
  31. <<security-api-saml-authenticate,SAML authenticate API>>. Alternatively, the most
  32. recent token that was received after refreshing the original one by using a
  33. `refresh_token`.
  34. `refresh_token`::
  35. (Optional, string) The refresh token that was returned as a response to calling the
  36. <<security-api-saml-authenticate,SAML authenticate API>>. Alternatively, the
  37. most recent refresh token that was received after refreshing the original access token.
  38. [[security-api-saml-logout-response-body]]
  39. ==== {api-response-body-title}
  40. `redirect`::
  41. (string) A URL that contains a SAML logout request as a parameter. The user
  42. can use this URL to be redirected back to the SAML IdP and to initiate Single
  43. Logout.
  44. [[security-api-saml-logout-example]]
  45. ==== {api-examples-title}
  46. The following example invalidates the pair of tokens that were generated by
  47. calling the <<security-api-saml-authenticate,SAML authenticate API>>
  48. with a successful SAML response:
  49. [source,console]
  50. --------------------------------------------------
  51. POST /_security/saml/logout
  52. {
  53. "token" : "46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3",
  54. "refresh_token" : "mJdXLtmvTUSpoLwMvdBt_w"
  55. }
  56. --------------------------------------------------
  57. // TEST[skip:can't test this without a valid SAML Response]
  58. The API returns the following response:
  59. [source,js]
  60. --------------------------------------------------
  61. {
  62. "redirect" : "https://my-idp.org/logout/SAMLRequest=...."
  63. }
  64. --------------------------------------------------
  65. // NOTCONSOLE