saml-prepare-authentication-api.asciidoc 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. [role="xpack"]
  2. [[security-api-saml-prepare-authentication]]
  3. === SAML prepare authentication API
  4. Creates a SAML authentication request (`<AuthnRequest>`) as a URL string, based on the configuration of the respective SAML realm in {es}.
  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-prepare-authentication-request]]
  8. ==== {api-request-title}
  9. `POST /_security/saml/prepare`
  10. [[security-api-saml-prepare-authentication-desc]]
  11. ==== {api-description-title}
  12. This API returns a URL pointing to the SAML Identity
  13. Provider. You can use the URL to redirect the browser of the user in order to
  14. continue the authentication process. The URL includes a single parameter named `SAMLRequest`,
  15. which contains a SAML Authentication request that is deflated and
  16. Base64 encoded. If the configuration dictates that SAML authentication requests
  17. should be signed, the URL has two extra parameters named `SigAlg` and
  18. `Signature`. These parameters contain the algorithm used for the signature and
  19. the signature value itself.
  20. It also returns a random string that uniquely identifies this SAML Authentication request. The
  21. caller of this API needs to store this identifier as it needs to used in a following step of
  22. the authentication process (see <<security-api-saml-authenticate,SAML authenticate API>>).
  23. {es} exposes all the necessary SAML related functionality via the SAML APIs.
  24. These APIs are used internally by {kib} in order to provide SAML based
  25. authentication, but can also be used by other custom web applications or other
  26. clients. See also <<security-api-saml-authenticate,SAML authenticate API>>,
  27. <<security-api-saml-invalidate,SAML invalidate API>>, and
  28. <<security-api-saml-logout,SAML logout API>>.
  29. [[security-api-saml-prepare-authentication-request-body]]
  30. ==== {api-request-body-title}
  31. `acs`::
  32. (Optional, string) The Assertion Consumer Service URL that matches the one of the SAML
  33. realms in {es}. The realm is used to generate the authentication request.
  34. You must specify either this parameter or the `realm` parameter.
  35. `realm`::
  36. (Optional, string) The name of the SAML realm in {es} for which the configuration is
  37. used to generate the authentication request. You must specify either this parameter or the `acs`
  38. parameter.
  39. [[security-api-saml-prepare-authentication-response-body]]
  40. ==== {api-response-body-title}
  41. `id`::
  42. (string) A unique identifier for the SAML Request to be stored by the caller
  43. of the API.
  44. `realm`::
  45. (string) The name of the {es} realm that was used to construct the
  46. authentication request.
  47. `redirect`::
  48. (string) The URL to redirect the user to.
  49. [[security-api-saml-prepare-authentication-example]]
  50. ==== {api-examples-title}
  51. The following example generates a SAML authentication request for the SAML realm with name `saml1`
  52. [source,console]
  53. --------------------------------------------------
  54. POST /_security/saml/prepare
  55. {
  56. "realm" : "saml1"
  57. }
  58. --------------------------------------------------
  59. The following example generates a SAML authentication request for the SAML realm with an Assertion
  60. Consuming Service URL matching `https://kibana.org/api/security/saml/callback
  61. [source,console]
  62. --------------------------------------------------
  63. POST /_security/saml/prepare
  64. {
  65. "acs" : "https://kibana.org/api/security/saml/callback"
  66. }
  67. --------------------------------------------------
  68. This API returns the following response:
  69. [source,js]
  70. -------------------------------------------------
  71. {
  72. "redirect": "https://my-idp.org/login?SAMLRequest=fVJdc6IwFP0rmbwDgUKLGbFDtc462%2B06FX3Yl50rBJsKCZsbrPbXL6J22hdfk%2FNx7zl3eL%2BvK7ITBqVWCfVdRolQuS6k2iR0mU2dmN6Phgh1FTQ8be2rehH%2FWoGWdESF%2FPST0NYorgElcgW1QG5zvkh%2FPfHAZbwx2upcV5SkiMLYzmqsFba1MAthdjIXy5enhL5a23DPOyo6W7kGBa7cwhZ2gO7G8OiW%2BR400kORt0bag7fzezAlk24eqcD2OxxlsNN5O3MdsW9c6CZnbq7rntF4d3s0D7BaHTZhIWN52P%2BcjiuGRbDU6cdj%2BEjJbJLQv4N4ADdhxBiEZbQuWclY4Q8iABbCXczCdSiKMAC%2FgyO2YqbQgrIJDZg%2FcFjsMD%2Fzb3gUcBa5sR%2F9oWR%2BzuJBqlPG14Jbn0DIf2TZ3Jn%2FXmSUrC5ddQB6bob37uZrJdeF4dIDHV3iuhb70Ptq83kOz53ubDLXlcwPJK0q%2FT42AqxIaAkVCkqm2tRgr49yfJGFU%2FZQ3hy3QyuUpd7obPv97kb%2FAQ%3D%3D"}",
  73. "realm": "saml1",
  74. "id": "_989a34500a4f5bf0f00d195aa04a7804b4ed42a1"
  75. }
  76. -------------------------------------------------
  77. // NOTCONSOLE