saml-invalidate-api.asciidoc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. [role="xpack"]
  2. [[security-api-saml-invalidate]]
  3. === SAML invalidate API
  4. ++++
  5. <titleabbrev>SAML invalidate</titleabbrev>
  6. ++++
  7. Submits a SAML LogoutRequest message to {es} for consumption.
  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-invalidate-request]]
  11. ==== {api-request-title}
  12. `POST /_security/saml/invalidate`
  13. [[security-api-saml-invalidate-desc]]
  14. ==== {api-description-title}
  15. The logout request comes from the SAML IdP during an IdP initiated Single Logout.
  16. The custom web application can use this API to have {es} process the `LogoutRequest`.
  17. After successful validation of the request, {es} invalidates the access token
  18. and refresh token that corresponds to that specific SAML principal and provides
  19. a URL that contains a SAML LogoutResponse message, so that the user can be
  20. redirected back to their IdP.
  21. {es} exposes all the necessary SAML related functionality via the SAML APIs.
  22. These APIs are used internally by {kib} in order to provide SAML based
  23. authentication, but can also be used by other custom web applications or other
  24. clients. See also <<security-api-saml-authenticate,SAML authenticate API>>,
  25. <<security-api-saml-prepare-authentication,SAML prepare authentication API>>,
  26. <<security-api-saml-logout,SAML logout API>>, and
  27. <<security-api-saml-complete-logout, SAML complete logout API>>.
  28. [[security-api-saml-invalidate-request-body]]
  29. ==== {api-request-body-title}
  30. `acs`::
  31. (Optional, string) The Assertion Consumer Service URL that matches the one of the SAML
  32. realm in {es} that should be used. You must specify either this parameter or the `realm` parameter.
  33. `query_string`::
  34. (Required, string) The query part of the URL that the user was redirected to by the SAML
  35. IdP to initiate the Single Logout. This query should include a single
  36. parameter named `SAMLRequest` that contains a SAML logout request that is
  37. deflated and Base64 encoded. If the SAML IdP has signed the logout request,
  38. the URL should include two extra parameters named `SigAlg` and `Signature`
  39. that contain the algorithm used for the signature and the signature value itself.
  40. In order for {es} to be able to verify the IdP's signature, the value of the query_string field must be an exact match to the string provided by the browser.
  41. The client application must not attempt to parse or process the string in any way.
  42. `queryString`::
  43. deprecated:[7.14.0, "Use query_string instead"]
  44. See `query_string`.
  45. `realm`::
  46. (Optional, string) The name of the SAML realm in {es} the configuration. You must specify
  47. either this parameter or the `acs` parameter.
  48. [[security-api-saml-invalidate-response-body]]
  49. ==== {api-response-body-title}
  50. `invalidated`::
  51. (integer) The number of tokens that were invalidated as part of this logout.
  52. `realm`::
  53. (string) The realm name of the SAML realm in {es} that authenticated the user.
  54. `redirect`::
  55. (string) A SAML logout response as a parameter so that the user can be
  56. redirected back to the SAML IdP.
  57. [[security-api-saml-invalidate-example]]
  58. ==== {api-examples-title}
  59. The following example invalidates all the tokens for realm `saml1` pertaining to
  60. the user that is identified in the SAML Logout Request:
  61. [source,console]
  62. --------------------------------------------------
  63. POST /_security/saml/invalidate
  64. {
  65. "query_string" : "SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D",
  66. "realm" : "saml1"
  67. }
  68. --------------------------------------------------
  69. // TEST[skip:handled in IT]
  70. [source,js]
  71. --------------------------------------------------
  72. {
  73. "redirect" : "https://my-idp.org/logout/SAMLResponse=....",
  74. "invalidated" : 2,
  75. "realm" : "saml1"
  76. }
  77. --------------------------------------------------
  78. // NOTCONSOLE