Checking saml responses in OpenAM - openam

I'm new to OpenAM. i have configured openAM as SP and federated it with a remote IDP using SAML. everything works fine but i wonder where can i check the SAML responses that comes from the IDP. I verified all the logs but nothing found . Any ideas ?

Enable message level debugging
http://openam.example.com:8080/openam/Debug.jsp
and under your Openam home OPENAM_HOME/log folder you should see files
which are named as
SAML2.access-06.20.13-08.52
SAML2.access-06.20.13-11.52
SAML2.error-06.20.13-15.42
In these files you should see saml response in the form
Some more info at
http://openam.forgerock.org/openam-documentation/openam-doc-source/doc/admin-guide/index/chap-monitoring.html#log-mgmt
-Rama

try saml tracer addon im tomcat in firefox.

Got the SAML Response as URL parameters. We need to retrieve it from openAM and decode it ,
String samlResponse = request.getParameter("SAMLResponse");

Related

SAML IdP SLO (single logout) with Azure AD B2C is failing

We have an Azure AD B2C instance with custom policy to allow users to sign with their credential from an external SAML identity provider, the configuration is based on this Microsoft Doc: https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-generic-saml?tabs=windows&pivots=b2c-custom-policy.
The custom policy works except for the single logout (SLO) request. The interesting part is, in Chrome the SLO request works but in Firefox and Safari it fails.
During a sign out flow the browser (Firefox is used in this example) receives a payload with a SAML logout request from the Azure AD B2C. The payload is then loaded into an iframe so that the SAML logout request can be posted to the SAML IdP. In the row 41 in the client side script in the following image you can see a iframe that is being appended to the DOM in the method frameLoader, and this is where the request fails.
Image of the client side script
And here is the stack trace of the exception for the call to frameLoader.
Image of the stack trace
I thought the issue was related to cookies and cross-site request forgery (CSRF), so I configured a custom domain for the Azure AD B2C, but that didn’t resolve the issue. I also thought it had to do with the SameSite attribute in a cookie, so I tried editing one of them but that didn’t fix the issue.
Is there anyone that has encountered this issue and knows how to resolve it?
UPDATE
Further debugging relieved that the issue is related to Firefox way of handling pop-up window. The SAML SLO request works only when I add the URL of the web application as allowed website for window pop-up in Firefox.
Is there a workaround for allowing iframe to be loaded into the parent web application without adding the URL of the web application as allowed website for window pop-up in Firefox?
it could be a non issue in your use case but there is a feature in Azure LogoutResponses when sent via HTTP-Redirect. The are encoded in lower case. the examples you show do indicate a lowercase uppercase difference %3a instead of %3A in the other image.
The work around is to have the SAML library use the REDIRECT_URI in most cases. As an hack you can replace the letters in the encodings with lowercase characters.
if this is your issue the problem is that the signature cannot match because a and A are not equivalent.

Can I use the Azure Active Directory libraries (ADAL) to get a SAML response from Azure AD?

I want to write a script that:
Logs a user into Azure AD with the device code mechanism
Constructs a SAML SSO request URL
Makes the SAML request using the auth from step 1
Gets the SAML response back, and does something with it (not just open it in a browser)
Is there a way to do that with the Azure AD libraries?
I feel like this should be possible and I’m just missing something. Any ideas?
I've tried a bunch of stuff and experimented with code in the Python library, but to no avail.
I would prefer Python, but I can run it in a Docker image so language isn’t so important.
Context
At work, we use Azure AD for authentication, and we can log into the AWS Console using Azure AD and SSO SAML.
If I construct an appropriate SAML request URL and open it in my browser, I go through the in-browser auth flow. When I’m logged in, Azure AD returns a SAML response, and eventually my browser redirects me to the AWS console. It’s a URL of the form:
https://login.microsoftonline.com/11111111-1111-1111-11111111111/saml2?SAMLRequest=<base64 encoded string>
Now I want to do a similar flow for AWS credentials – make a SAML request to log in, read the SAML response, create credentials using assume_role_with_saml, then write those to ~/.aws/credentials. I think that means I have to access the SAML response directly – the browser just drops me at the end of the redirect chain.
Any ideas?
Other ideas
I’m aware of the aws-azure-login npm package which does this by spinning up a headless browser – but it’s unmaintained and I’ve found it to be a flaky.
Right now I have a Python script that opens the SAML request in Chrome (where I log in), then uses the browsercookie library to raid Chrome’s cookie jar and use those for its HTTP requests. That works, but it feels weird to be copying cookies this way. Also, it doesn’t work if I’m ssh'd into a remote server.
I found an answer from a year and a half ago that says “ADAL.JS does not support SAML2 tokens”. Wondering if that might have changed, or am I still stuck?
No - ADAL is OpenID Connect and returns a JWT token.
Why do you need to use SAML? Could you not use OpenID Connect?
Azure AD does not support SAML tokens for the device code flow.
MSAL library from the Azure AD team supports this flow for apps. Please give this a try or you can write code against the protocol itself

How to configure SSO for multiple subdomains of a SP Initiated login flow with Onelogin?

I have multiple sub-domains listed in a SaaS app. The app provides options to configure SSO with Onelogin, however it provides the option to Enter only one SAML Endpoint(to which users will be redirected) and One certificate.
In this specific case with Onelogin, the certificate with One login is same across different apps that are setup at Onelogin, however each app has a different SAML endpoint. This makes it impossible to configure SSO with multiple sub-domains of the SAML app.
Tried using SAML Connectors (Advanced) in Onelogin, however when multiple connectors are setup each still has a different SAML endpoint.
Any help in configuring an app in Onelogin using same SAML Endpoint would be very helpful.
You're at the mercy of your SP here. If it only supports one IdP, then there's nothing you can put in place in Onelogin to mitigate that. To extend #todaynowork's answer above, the RelayState parameter might be of use to you but your SP will need to support it. The RelayState parameter allows the SAML request to include the resource your user was initially requesting. When the SAML response is verified at the ACS URL, you can then use the RelayState parameter to redirect the user to their requested resource across any of the subdomains. Assuming your SP side sessions are consistent across all subdomains, that could work for you.
Suggest you use the SP initial SSO. That support deep link. Deep link means you could pass the return url while you do auth request. After success login, it will return to 'return url' you passed.

How to include configured claims in ADFS (as IDP) metadata.xml or know them in advance (before the profile object returned)?

I am using Saml SSO with ADFS (as IDP), in ADFS UI I configured all the needed data for my SP (third party) application including roles (claims).
Now in ADFS there is an option to copy a link of the federation metadata xml with all of my configured data.
My problem is: in this metadata xml link ADFS gave me I can’t find the roles (claims) that I defined (I can see them in the profile respond object that returned after a successful authentication but not in the metadata xml).
My questions are:
1. Does the ADFS metadata xml should include my claims?
2. If yes, can you explain me please how can I include them?
3. Else, can you suggest a way for me to know which claims (keys) are going to return in the profile object in front?
Thanks.
No - metadata is server specific not user specific
You only get the claims you configure on ADFS

How to retrieve user attributes through SAML in WSO2 Identity Server

I'm doing a sample webapp that authenticates against WSO2 Identity Server through SAML. It works fine but now I wanted to retrieve user attributes and roles for authorization and I'm completely lost.
Reading some SAML docs I know that I must send an AttributeQuery request but not how and I've made up that I should use a SOAP request but I don´t know how the server works. I don´t know if WSO2-IS offers a web service or other method. If yes, which would be the wsdl URL to generate the client? And if not, which method should I follow. It could be also possible that the same authentication response includes the user attributes.
Thank you for your help and sorry if the solution is obvious. I haven't found anything about this in your docs and I'm not familiar with security enviromnents and I don´t understand all the options the admin console shows.
While attribute request can be sent to get the details of one or more user attributes, you can get all the information through one call (authentication request) - all the attributes of the user (attributes in the default profile) and the roles of the user.
There is a basic demo application available.
To get attributes, you should use WSO2 4.0 M8 release (which supports the attribute profile).
Once a Service Provider is registered, we can select the required attributes that should be returned. More information about this and the link to get the WSO2 4.0 M8 release can be got from the comment section of "SAML2.0 SSO with the WSO2 Identity Server".
This article provides a detailed description to get user details after SAML Authentication

Resources