saml-prepare-authentication-api.asciidoc 4.6 KB

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