Configuring SAML in Anypoint Platform External Identity to enable SSO is well documented here. However, there are times when authentication fails with an "Unauthorized" error. This article gives some guidelines on troubleshooting this issue.
Here are steps to troubleshoot the "Unauthorized" error with authentication using SSO.
For SAML 2 based SSO, since May 30, 2020, Anypoint Platform supports both IdP-Initiated SSO and SP-Initiated SSO. Please reference SP-Initiated SSO Using IDP-Initiated SSO URL Fails with Unauthorized Error and make sure the correct SSO URL is configured in the Anypoint Platform.
After a user is authenticated by IDP, a SAML token is generated from the IDP and will be sent (POST) to one of the below endpoints depending on where the Anypoint Platform Organization's located:
Note: in the above URLs, all the values within < > need to be replaced by actual values that can be obtained by navigating to Anypoint > Access Management > Identity Provider > Identity Provider details > Assertion Consumer Service (ACS) field value
Please see the sequence diagram below(using IdP Initiated SSO as an example):
To troubleshoot the "Unauthorized" issue, we need to capture the SAML sent from the browser to the Anypoint Platform.
You can use browser plugins like "SAML tracer" for Firefox or "SAML Chrome Panel" for Chrome to capture the HTTP request/response, including SAML assertion. You can also follow the steps in How to Extract SAML Assertion XML From HAR File.
Locate the "issuer" and "audience" in your SAML. It is something like:
<ns1:Issuer xmlns:ns1="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">ISSUER_STRING</ns1:Issuer> ... <ns2:AudienceRestriction> <ns2:Audience>AUDIENCE_STRING</ns2:Audience> </ns2:AudienceRestriction>
Please make sure the content of the "issuer" and "audience" are EXACTLY identical, respectively to what you configured in Anypoint Platform Identity Management SAML 2.0 section. Any mismatch would cause a failure, for example:
http://stgfederate.mydomain.com/mule does NOT match https://stgfederate.mydomain.com/mule
Locate the X.509Certificate in your SAML. It is something like:
<ds:X509Certificate> PUBLIC_CERTIFICATE_PERM_FORMAT_STRING </ds:X509Certificate>
Please make sure the content of "X.509Certificate" is EXACTLY identical to what you configured in Anypoint Platform Identity Management SAML 2.0 "Public Key" section.
If "Username Attribute" mapping is not configured, Anypoint Platform will look for the "NameID" in the Subject section of the SAML assertion. However, if a "Username Attribute" mapping is configured, Anypoint Platform will look for the configured attribute name/value from SAML attributes, and fail if it's not found.
Email is mandatory for a user to exist in the Anypoint Platform. If "Email Attribute" mapping is not configured, Anypoint Platform will look for the "email" attribute from the SAML attributes. However, if the email attribute name in the SAML assertion is different to "email", "Email Attribute" mapping needs to be configured to match the actual attribute name.
Group is not mandatory for a user to exist in the Anypoint Platform. But if your user is assigned a group in SSO, then a group attribute is needed and needs to be configured
e.g., your SAML might have an entry like below
<Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/groups">
If all above are checked while "Unauthorized" is still seen, please open a Support case with the following information:
With the above information, support will be able to complete further investigations into the possible reasons for the authentication failure.
001118485

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.