@@ -575,17 +575,37 @@ Authentication in {kib} fails and the following error is printed in the
575575Authentication to realm my-saml-realm failed -
576576Provided SAML response is not valid for realm saml/my-saml-realm
577577(Caused by ElasticsearchSecurityException[SAML Response is not a 'success' response:
578- Code=urn:oasis:names:tc:SAML:2.0:status:AuthnFailed Message=null Detail=null])
578+ The SAML IdP did not grant the request. It indicated that the Elastic Stack side sent
579+ something invalid (urn:oasis:names:tc:SAML:2.0:status:Requester). Specific status code which might
580+ indicate what the issue is: [urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy]]
581+ )
579582....
580583
581584*Resolution:*
582585
583586This means that the SAML Identity Provider failed to authenticate the user and
584587sent a SAML Response to the Service Provider ({stack}) indicating this failure.
585- The `Code`, `Message` and `Detail` can convey different error identifiers and
586- additional information that might offer an indication about the cause of the
587- failure. In case `Message` and `Detail` are null, please consult the logs and
588- documentation of the Identity Provider in order to further diagnose the problem.
588+ The message will convey whether the SAML Identity Provider thinks that the problem
589+ is with the Service Provider ({stack}) or with the Identity Provider itself and
590+ the specific status code that follows is extremely useful as it usually indicates
591+ the underlying issue. The list of specific error codes is defined in the
592+ https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf[SAML 2.0 Core specification - Section 3.2.2.2]
593+ and the most commonly encountered ones are:
594+
595+ . `urn:oasis:names:tc:SAML:2.0:status:AuthnFailed`: The SAML Identity Provider failed to
596+ authenticate the user. There is not much to troubleshoot on the {stack} side for this status, the logs of
597+ the SAML Identity Provider will hopefully offer much more information.
598+ . `urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy`: The SAML Identity Provider cannot support
599+ releasing a NameID with the requested format. When creating SAML Authentication Requests, {es} sets
600+ the NameIDPolicy element of the Authentication request with the appropriate value. This is controlled
601+ by the {ref}/security-settings.html#ref-saml-settings[`nameid_format`] configuration parameter in
602+ `elasticsearch.yml`, which if not set defaults to `urn:oasis:names:tc:SAML:2.0:nameid-format:transient`.
603+ This instructs the Identity Provider to return a NameID with that specific format in the SAML Response. If
604+ the SAML Identity Provider cannot grant that request, for example because it is configured to release a
605+ NameID format with `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent` format instead, it returns this error
606+ indicating an invalid NameID policy. This issue can be resolved by adjusting `nameid_format` to match the format
607+ the SAML Identity Provider can return or by setting it to `urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified`
608+ so that the Identity Provider is allowed to return any format it wants.
589609--
590610
591611. *Symptoms:*
0 commit comments