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