To troubleshoot SAML-based single sign-on (SSO) to Anypoint Platform, you often need to read the SAML assertion that the identity provider (IdP) sends. This article shows how to find the SAML response in an HTTP Archive (HAR) file captured during an SSO sign-in and decode it into readable XML.
HAR files can contain sensitive data, including cookies, authentication tokens, and personal information, which can lead to impersonation and unauthorized access. A SAML response is itself a sign-in credential until it expires. Before you send a HAR file to Salesforce Support or a third party, complete these safeguards:
receive-id. Find the POST request whose URL path ends in /receive-id. This is the assertion consumer service (ACS) URL configured in your IdP; its host and path depend on your control plane (US, EU, or Gov) and identity provider, as described in Configuring SAML SSO for Anypoint Platform.postData parameter named SAMLResponse and copy its value, which is a long string.The request looks similar to this excerpt from a HAR file (values shortened):
"request": {
"method": "POST",
"url": "<your ACS URL ending in /receive-id>",
"httpVersion": "HTTP/1.1",
...
"postData": {
"mimeType": "application/x-www-form-urlencoded",
"text": "SAMLResponse=PD94b...&RelayState=",
"params": [
{
"name": "SAMLResponse",
"value": "PD94b..."
},
{
"name": "RelayState",
"value": ""
}
]
}
},
The SAMLResponse value is Base64-encoded and can also be URL-encoded (for example, it contains %2B or %3D). Decode it in two steps: URL-decode it, then Base64-decode the result. URL-decoding a value that is not URL-encoded leaves it unchanged, so you can always run both steps. Decode it on your own computer rather than pasting it into a third-party website, because the response contains user identity details and stays valid until it expires.
samlresponse.txt.This Python 3 command URL-decodes and then Base64-decodes the file and prints the XML:
python3 -c "import urllib.parse,base64;print(base64.b64decode(urllib.parse.unquote(open('samlresponse.txt').read().strip())).decode())"
Alternatively, in your browser's Developer Tools console, run this JavaScript expression with the copied value in place of the placeholder:
atob(decodeURIComponent("PASTE_SAMLRESPONSE_VALUE_HERE"))
The output is the SAML response XML, including the assertion, similar to this example (signatures and certificates shortened):
<?xml version="1.0" encoding="UTF-8"?> <saml2p:Response Destination="<your ACS URL>" ID="id102899906075521711077394618" IssueInstant="2020-10-06T00:49:08.454Z" Version="2.0" xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><your IdP issuer></saml2:Issuer> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...</ds:Signature> <saml2p:Status xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"> <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/> </saml2p:Status> <saml2:Assertion ID="id102899906076315621983006756" IssueInstant="2020-10-06T00:49:08.454Z" Version="2.0" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><your IdP issuer></saml2:Issuer> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...</ds:Signature> <saml2:Subject xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">jane.doe@example.com</saml2:NameID> <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> <saml2:SubjectConfirmationData NotOnOrAfter="2020-10-06T00:54:08.454Z" Recipient="<your ACS URL>"/> </saml2:SubjectConfirmation> </saml2:Subject> <saml2:Conditions NotBefore="2020-10-06T00:44:08.454Z" NotOnOrAfter="2020-10-06T00:54:08.454Z" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> <saml2:AudienceRestriction> <saml2:Audience>anypoint.mulesoft.com</saml2:Audience> </saml2:AudienceRestriction> </saml2:Conditions> <saml2:AuthnStatement AuthnInstant="2020-10-06T00:49:08.454Z" SessionIndex="id1601945348452.291824165" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> <saml2:AuthnContext> <saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml2:AuthnContextClassRef> </saml2:AuthnContext> </saml2:AuthnStatement> <saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> <saml2:Attribute Name="firstname" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Jane</saml2:AttributeValue> </saml2:Attribute> <saml2:Attribute Name="lastname" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Doe</saml2:AttributeValue> </saml2:Attribute> <saml2:Attribute Name="email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">jane.doe@example.com</saml2:AttributeValue> </saml2:Attribute> <saml2:Attribute Name="group" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">...</saml2:AttributeValue> </saml2:Attribute> </saml2:AttributeStatement> </saml2:Assertion> </saml2p:Response>
Compare the Issuer, Audience, NameID, Recipient, time conditions, and attributes in the assertion with the identity provider settings in Anypoint Platform Access Management.
001115955

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.