How to configure the redirect to OpenAM IDP with Spring Security SAML 2.0 without discovery? - saml-2.0

I have created the circle of trust between the service provider and the openam IDP. The issue that we are facing is that I am always redirected at the select provider interface. What we want is that the user is been redirected directly for login and authenication to the IDP.
Here is the example used:
https://github.com/spring-projects/spring-security-saml/tree/2.0.0.M11/samples/boot/simple-service-provider/src/main/java/sample/config
Based on this I am redirected to the IDP select page, and I want to get redirected to the IDP login page for authentication.

If you only have one IdP in the list for bean id="metadata" this IdP will be used.

Related

InvalidRequesMessage error when trying Azure AD IDP initiated SSO - Keycloak

I am using Keycloak 12.0.1 as an identity broker and Azure AD as an identity provider using SAML2.0. I get below error when trying to do IDP initiated SSO -
SP initiated sign-on works fine. The error message is not descriptive enough to find the root cause. I've not setup any client in Keycloak, I want this to work just like SP initiated sign-on in which after successful login, Keycloak profile page is displayed.
Below are links to the metadata -
Service Provider Metadata
SAML Response by Azure AD
Update:
I forgot to mention that Keycloak expects relay-state in IDP initiated sso response (without which Keycloak shows NullPointerException on the server console) but I'm not sure what value I should provide for relay-state here because I've not setup any custom clients. I want Azure AD to redirect to the default client that Keycloak provides (i.e account-console).
I grabbed relay-state from SP initiated sign-on and used the same value for IDP initiated one and the NullPointerException goes away but I get 'InvalidRequesMessage'. So I'm suspecting it has to do with the relay-state value I'm using.

Can we use OneLogin/Okta/Auth0 as Proxy SP between Google IdP and application

We have an application for which we would like to enable users to login into our application with their own Identity Providers like Google, ADFS etc with SAML 2.0 as protocol.
In this context our application will be SP and Identity Providers will be Google, ADFS.
But currently we don't have SAML implementation at our application, so we would like to use some platform like OneLogin/Okta/Auth0 as middle proxy between our application and IdP so that SAML related handling can be done at OneLogin/Okta/Auth0 and we need to get callback to our application with user details after success login.
Is this possible with any SASS based SAML providers? and how to do it.
Thanks in advance
Yes - connect to Auth0 / Okta via OpenID Connect and then connect the IDP to other IDP via SAML.
So in this context, Auth0 / Okta is a SAML SP.
Have a look here.

Sign-in with Microsoft identity provider fails, works for other providers

Sign-in with Microsoft identity provider fails, works with others
I have an Azure AD B2C tenant with a SingIn and SignUp policy that I hope to use
for user management with an Angular2 SPA.
The policy is configured for three identity providers:
Google
Microsoft
Email Signup
When I use the Run Now button in the Azure portal to run this policy, I get the default Sign In dialog, and I can sign in with either Google or Email signin. (By that I mean I get re-directed to my app's redirect page as I expect.) However, when I try to sign in using the Microsoft
provider, I end up at an error page with the following address:
https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.&state=StateProperties%3deyJTSUQiOiJ4LW1zLWNwaW0tcmM6NDcyMmQyNjItOTk1Yi00YTJlLWFmNWUtODkwNDgyODlhMzM0IiwiVElEIjoiM2Y2ZDVmNjAtMDdiNC00ZDA3LWEyZDItN2U3YWQwOWRhOGQ5In0
I see that the problem is related to an invalid redirect_uri. But I thought the redirect_uri was an application-level setting shared by ALL identity provders that I have configured. Why does my redirect_uri setting work for Google and Email signup, but not for Microsoft?
You have to configure your Microsoft application with the right redirect URL.
As stated in the documentation:
Enter https://login.microsoftonline.com/te/{tenant}/oauth2/authresp in the Redirect URIs field. Replace {tenant} with your tenant's name (for example, contosob2c.onmicrosoft.com).
Why you have to do this: (courtesy of Chris Padgett)
The redirect URI that is configured in the Azure AD B2C Portal represents the reply address for your client application. This is so Azure AD B2C can return an ID token to your client application. The redirect URI that is configured in the Application Registration Portal represents the reply address for your Azure AD B2C tenant. This is so the Microsoft Account identity provider can return a security token to your Azure AD B2C tenant.
So, your app is federating authentication to Azure AD B2C.
B2C then further federates to the Microsoft Account identity provider.
So when a user a logs in with a Microsoft account, they are sent back to B2C with a token, which B2C validates.
If all is okay, they are signed in to B2C, and sent back to your app.
So you see that from the point of view of the MSA identity provider, B2C is the client.
So the redirect URL there must point to B2C.
As the document stated, you should Enter https://login.microsoftonline.com/te/{tenant}/oauth2/authresp in the Redirect URIs field.
But I thought the redirect_uri was an application-level setting shared
by ALL identity provders that I have configured. Why does my
redirect_uri setting work for Google and Email signup, but not for
Microsoft?
You're right, the redirect_uri is an applicaiton-level sttings. It should be same in all IDPs redirect URIs. But this Redirec URI is set by Azure. NOT your applicaiton. It means that your can use other IDPs to login to your app with AAD B2C, NOT login to your applicaiton directly. So, the redirect_uris must be https://login.microsoftonline.com/te/{tenant}/oauth2/authresp, not the redirect_uri in your application itself.
URI doesn't equal URL. The redirect URI is just a unique identifier to which Azure AD will redirect the user-agent in an OAuth 2.0 request. It's not redirect URL, Azure AD authentication endpoint https://login.microsoftonline.com/ use redirect URIs to check where it should be responsed. Aslo, it can be same as the URL as the endpoint. Here should be the same I guess.
Summary, you need use the unique redirect URI https://login.microsoftonline.com/te/{tenant}/oauth2/authrespfor all IDPs , not just Microsoft account.
Hope this helps!

Redirect back from Service Provider to idP

I am using Kentor.AuthServices to implement Service Provider in a Web Forms application. I am seeing the SP redirect to idP and then POST the SAML to idP. However, it gets redirected back to idP again. I am guessing some configuration is not right, but not able to track it down.

SAML Response authentication

Scenario:
Browser(User) requests resource from Service Provider (SP).
SP Redirects (with SAML Request) to Identity Provider (IdP).
Since it is first login, User gives the (IdP) his/her valid credentials.
IdP then redirects Browser (with SAML Response which includes SAML token) to the SP page.
Application has a link to different application. The Second application needs to validate the user credentials with the same IdP.
User clicks on that link and browser opens the second application. Browser contains the same SAML response from SP.
In Step 5 how can I authenticate the user with SAML response and allow the user to be logged in automatically.
Do I need another SP?
I will not be able to use the SP from step 1 as it is external application.
Appreciate your help
If the second application is in a different administrative domain, it should be done through its own SAML SP starting another SAML request/response exchange with the IDP. If it is in the same domain you may be able to pass an intra-domain credential such as a cookie between the first application and the second (or rely on full SAML as well). You would never reuse the same SAML response because that is meant to be one-time use only.

Resources