Processing saml signed response using idp meta data ? saml +adfs + idp - saml-2.0

I am doing saml2.0 authentication as a service provider. after authenticating to my IP(identity provider) I am getting a response
like bellow
https://localhost:4200/map?SAMLResponse=pVRNj5swEP0riDvfkIDFIqXJJVK3u0pWe9hL5dhDQwUYecx2f35tKMmySmmrnvA8zbx5nnkmR9rUHTkAdqJFsPa7O%2fsrZEkcrCPmxFkcOXFaRk56iksnjJI0CU808GlgW88gsRLtnR26vm3tEXvYt6hoqzTkh4Hjp04QPgUJSRIS%2bO46SV9saweoqpaqofKsVIfE82rBaH0WqEgc%2br7X0M62tkaP4eplSwTFCklLG0CiGDlu7j8T3ZawMYn0LXbAqrICbltvTd0iGS62XN1JoQQTtV3kg3w5li4XUUSQRr5dGPlavenkNjXl6DZVy2vxrWIu7TqP8hI9nf1aMUBPyR5V7o2dinwc%2fFFR1eM82goO1jOte1hWgkM2OfZM06NteUXuzVk3k9ZxrzwrgzKJuZNR8J2Yw9rJIh3GdO2nCZyyVZT83SbXLx%2f3%2f2%2bT%2bzXv%2f5vgsT99B6YuB%2b2YspLN4C3rHtRZ8D%2b4pyEnoBKkfZNjRxW1vgj10D7ITalAzqexIr5%2f9fVB26%2brBsMuudrs6EarK1rkGueVAdE0%2fwSlkPC7Pax05yWF7%2fK0G3quBTLQj13Jio19J7CYVHN4%2fbAELTz3LnnX44zHu8o2pOrcGhNCoydiDeFNRwXED0icuqssGhXqRE2k4E3No22t3XOAslg0GCPM5Gn4UX9%2bCMkf9RPXUwX%2bJKn%2bRwipjP4bvHN4Ci93MMBk38szm%2f6axU8%3d&Signature=vY2pfmvhiy%2fhUmh1Gngn9WntOYU30sxjSU6JhSVLEWOVj6Y0bZM73eI6Ad%2fXRdOUwfqTx2vjtpVRqZJfe9I9%2fM0SkyQ90bGdHUpK%2bMdrrm6KuXoC1SR1MRZAV1ebRcKwlLOcK4KO39TC%2bQs0jVGtvBeO9w4ypPzWRp1OOFQybbd%2bE7Q7xj6DcRlhiyli5S5TfGnK%2f5D9nj3ZEiZWPjn9FFKVfAWpuqMyDPbeDibktl3jLmvih8B1mbOLx%2fRyQZe8Klx381BqZd7Bg8NzHoEvqRvdfrqEslnjZSuF5vCpSKFdKhZ7KQGazj66SnQbVUXB9UvT480tWlwjhwkraXY58Q%3d%3d&SigAlg=http%3a%2f%2fwww.w3.org%2f2001%2f04%2fxmldsig-more%23rsa-sha256 >>
Instead of xml response am getting like above and my question is how to process it ?

To see the response, plug the below into e.g. this.
pVRNj5swEP0riDvfkIDFIqXJJVK3u0pWe9hL5dhDQwUYecx2f35tKMmySmmrnvA8zbx5nnkmR9rUHTkAdqJFsPa7O%2fsrZEkcrCPmxFkcOXFaRk56iksnjJI0CU808GlgW88gsRLtnR26vm3tEXvYt6hoqzTkh4Hjp04QPgUJSRIS%2bO46SV9saweoqpaqofKsVIfE82rBaH0WqEgc%2br7X0M62tkaP4eplSwTFCklLG0CiGDlu7j8T3ZawMYn0LXbAqrICbltvTd0iGS62XN1JoQQTtV3kg3w5li4XUUSQRr5dGPlavenkNjXl6DZVy2vxrWIu7TqP8hI9nf1aMUBPyR5V7o2dinwc%2fFFR1eM82goO1jOte1hWgkM2OfZM06NteUXuzVk3k9ZxrzwrgzKJuZNR8J2Yw9rJIh3GdO2nCZyyVZT83SbXLx%2f3%2f2%2bT%2bzXv%2f5vgsT99B6YuB%2b2YspLN4C3rHtRZ8D%2b4pyEnoBKkfZNjRxW1vgj10D7ITalAzqexIr5%2f9fVB26%2brBsMuudrs6EarK1rkGueVAdE0%2fwSlkPC7Pax05yWF7%2fK0G3quBTLQj13Jio19J7CYVHN4%2fbAELTz3LnnX44zHu8o2pOrcGhNCoydiDeFNRwXED0icuqssGhXqRE2k4E3No22t3XOAslg0GCPM5Gn4UX9%2bCMkf9RPXUwX%2bJKn%2bRwipjP4bvHN4Ci93MMBk38szm%2f6axU8%3d
You'll see the response.
Programmatically, use a library e.g. this.

Related

How to obtain the attributes of a saml response sent by Azure Active Directory?

I have a saml response that gives me azure active directory when doing the process with saml 2.0, the whole process is done normally, I send a saml request and the azure active directory returns the saml response, to do the whole process I have based on this guide, I've been reading a bit and I've noticed that Azure AD in the saml response sends the values within this tag:
<xenc:CipherData>
<xenc:CipherValue>VALUE HERE</xenc:CipherValue
</xenc:CipherData>
And not inside:
<AttributeStatement><Attribute Name="IDPEmail"><AttributeValue>administrator#contoso.com</AttributeValue></Attribute></AttributeStatement>
as specified in the documentation. The question is, how to get the true values that azure active directory is sent to me and not these encoded values, I am using Python 3 and Google App Engine, in addition to mentioning azure active directory and saml 2.0 to do the login process, I leave the SAML response complete in this url in case it serves to give a better context to my question.
As mentioned above, the SAML response you are getting is encrypted. Specifically Azure is encrypting its assertions (including the ones you are looking for) inside an encrypted body called CipherData.
You have two options:
1 - Disable SAML response encryption.
Azure AD calls SAML response encryption as SAML token encryption which is a bit confusing. You can follow this guide to disable the response. You must have uploaded an encryption public key/cert before.
2 - Configure your service provider to supported encrypted SAML responses.
The SAML token is encrypted.
You need to get the client side certificate used for this and use that to decrypt it.

How to identify type of authorization?

I need to identify type of authorization on web-site to set-up this authorization in soapui request.
When I log in there is 'auth' POST-method detected in google chrome Network tab: https://xx.xx.xx.xx/services/auth? with payload {"login":"some_login","password":"some_passw"}
And when I do this request in SoapUI as POST HTTP request: https://xx.xx.xx.xx/services/auth?login=some_login&password=some_passw ; there is a responce of json format which contains "token": "eyJ0eXAiOiAiSldUIiwgImFs..."
I want to set up athorization for another method on this web-site, so first of all I need to know the type of authorization to set up in soapui Auth Tab:
UPDATE:
Token is not used in HTTP request types, it is available in e.g. REST request:
But I still can not make this token work
It seems that I was looking for the wrong type of athorization. All above is about server uthorization. But I need to complete web-app authorization.
So just using token in Header params of SoapUI did the trick:

SAML consumer URL

We are implementing SAML integration and I am the service provider and my identity provider is asking me to send "SAML Consumer URL" and "RelayState"
I would need help to understand what is SAML consumer URL & RelayState and how do I get/generate it for my application.
Thank you for your time and help!
TLDR, AssertionConsumerUrl (ACS) endpoint is SAML protocol endpoint, RelayState is like cross-domain cookie, used to coordinate messages and actions of IdPs and SPs.
In 5.1.Web Browser SSO Profile of SAML 2.0 Technical Review, it will give you a general understanding of how the flow goes.
Down to the SSO implementation, for example Shibboleth, this FlowAndConfig doc details the SSO flow pretty well.
In 2. SP Determines IdP and Issues Authentication Request:
Cookie Set by SP
During this step, the SP will preserve the original
resource requested by the browser using a "relay state" mechanism,
which is configured by a relayState property on the <SessionInitiator>
element. The default mechanism does not rely on a cookie any longer,
but many systems do, and send a state management cookie containing the
resource URL to the client along with the request prepared for the IdP
or DS/WAYF.
In 5. Back to the SP:
The browser delivers the response from the IdP to an Assertion Consumer Service endpoint at the SP.
relay state info returned from IdP to SP
Cookie Read by SP
The "relay state" information returned by the IdP, if any, will have
been created by the SP and if using a cookie, will point to a
specially named cookie that should accompany the authentication
response supplied to the ACS endpoint in this step. This is the cookie
set in Step 2 above. If this cookie is missing (or if no relay state
exists at all), the associated application's homeURL property is
substituted as a fall back.
Also, Shibboleth has some wiki for those two terms as well.
AssertionConsumerService concept
RelayState concept
Hope it helps!

How to check if the SAML Assertion Response from the IdP reaches the SP in Ping Federate?

The SAML Response will be posted to the following url:
https://domain/sp/ACS.SAML2
But when I try to hit the url, I am not able to see the response.
Anything wrong in my approach?
Thanks & Regards,
Aswini J
A few things assuming you are setting up SAML 2.0 Web SSO Profile -
What do you mean you can't "see" the Response? Are you successfully logging into the IDP and having it redirect the Browser to the PF ACS URL?
With PingFederate, the application and protocol end-points are case sensitive. You should use http(s)://www.server.com:<PF runtime port>/sp/ACS.saml2. If you simply request this value from your browser with a GET request and no SAML data, PingFed will show you a generic error template page.
If you have successfully POST'd the SAMLResponse to the right endpoint, you will see the actual SAMLResponse logged in the /pingfederate/log/server.log.

How to retrieve SAML Response from OpenAM for SalesForce

I got SAML assertion from TrustAuthorityClient API. with below Public API code
securityToken = client.getSecurityToken("default", endpointURL, mexEndpointURL,
(java.lang.Object)ssoToken, SecurityMechanism.STS_SECURITY_URI,
(getServletConfig()).getServletContext());
But this is created with SunSTS.
When I test this Assertion to retrieve access token from SalseForce. it gives me invalid Assertion.
Is there any way retrieve SAML response from OpenAM for SalesForce?
When I test IDP initiates SSO with SalesForce. In Debug log I can see SAML Response is created for SSO.
How should I retrieve this SAML response from OpenAM?
You may need to grab the SAML Response via JavaScript at the front end. The full response will be in a SAMLResponse object after SSO, so your Assertion Consumer Service URL (SP SSO URL) that would receive this would need to check for that parameter, save it and somehow submit to SFDC for OAuth token exchange. Alternatively, take the Assertion from SunSTS and make your SAMLP Response wrapper yourself.
I believe this is due to SFDC implementing an earlier draft of the SAML 2.0 Bearer Assertion Profiles for OAuth 2.0 (see: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-saml2-bearer-10).
The latest draft of that spec does not require the Response wrapper - likely just the Assertion itself from SunSTS will work, provided SFDC updates to support it.

Resources