Openid Connect single sign on external web sites - asp.net-mvc

I read about saml and openid connect on the web.
I am trying to implement asp.net mvc project with following requirements.
User logins my website.
User clicks external site link(ex trello.com) and redirected to external site login page.
After sign in a consent screen opens with predefined scopes.User approves and return back to my site.
Id token and access token are received.
To my knowledge, until now you can proceed with openid connect.
However I can't figure out how I can accomplish following requirement with openid connect.
After granting access (previous steps via authorization code flow) whenever user logins my site and clicks external site link, user will be automatically signed on external site. (Like Appdirect and Telstra do)
I know I can implement requirement 5 with SAML but I couldn't find a way to do with openid connect.

This is essentially SSO and SSO works like:
Application A authenticates with IDP X
Application B authenticates with IDP X
When user goes to B, they are already signed on with the same IDP and so they don't see a login screen.
But if user goes to:
Application C authenticates with IDP Y
they will not get SSO.

Related

outh2 using external form to authenticate with google account

We have a system that is using its own authentication system and I need to make it use our Google Workspace accounts to integrate with Google SSO so that when the user gives their credentials to the webpage, it will be authenticated in both google account and on our web app account.
Google default workflow redirects the user to its own form, so we have the problem of the password not being passed to our server.
Crossed my mind the fact that this would be too insecure to exist, but remember that all users that would log in to our website would have an account created in a workplace totally managed by us.
how could I auth the user this way?
Why not use "Sign-in with Google" -> OpenID Connect to access to the website. That way it will authenticate with Google.
Or add the website as a custom SAML application in the Admin console, and use Google as the IDP since the users will be provided by your organization.

Skipping the Home Realm Discovery Page for ADFS authentication

I am using ASP.net MVC open id connecto to authenticate user with ADFS. Whenever I hit application url It redirects to ADFS Home Realm Discovery page where we see multiple IDP (Client Accounts) to sign in.
How could we by pass this page and go directly to repsective IDP's login page depending on subdomain in URL.
For eg, if I have a couple of clients (tenant) 1. Cloud Network Pvt Ltd 2.Cloud ddns and I could see a couple of on-premise AD. If the user hits "cloudddns.myapp.com" then it should show on that client's ADFS sign in page.
You can map a RP to an IDP.
e.g. all users of RP A will use the Fabrikam IDP to authenticate.
The command is:
Set-AdfsRelyingPartyTrust -TargetName "RP A" -ClaimsProviderName #("Fabrikam","Active Directory")
Would that work for you?

Oauth 2.0 Authentication custom login page in Spring Boot

Here is my Problem statement:
I want to do OAuth authentication with external Authorization Server(say External Identity Provider) But user should provide credentials on my custom login page. I know when we do Oauth user must be redirected to Identity provider to authenticate and complete OAuth dance. But in my case, I want user to provide credentials on my login screen. No where in the process, user should see the identity provider login page. Any thoughts?
If the user enters his credentials on your login page, how will your app verify these creds with the identity server?
The idea of oAuth is that you app (the client app) will not be exposed to the user's creds.
Note: If there is a tight relationship between the client app and the identity-provider (e.g. Facebook and the Facebook app for mobile) so you can perform this with Resource Owner Password Credentials grant type.

How does OpenID Connect work?

Can someone shed some light on the use case for me. We wave users who will be signing in to third party client applications. Using OAUTH2 framework, the client app will redirect to our site to authenticate. From my undestanding, the Authorization server will return a access token and an id_token (OpenID Connect).
1) If the user is authenticated with us and is redirected to the client application, if they leave the client application and go back into the client application hours later, do they still have go through the whole redirect to our /authorization endpoint to re-authenticate?
2) If the user is authenticated with us and is redirected to the client application, if they leave the client application and go to our site, do they have to login again to authenticate?
Basically, does OpenID Connect over OAUTH2 allow a user to sign in once and then not have to sign in again after subsequent visit to the third party app or our app?
Thanks.
It depends on two things:
a. if the client application maintains a session and that session has not expired yet, the user won't be redirected at all
b. in case the client session timed out, the user will be redirected but if the IDP still has an authentication session running, the user will not have to authenticate and will be sent back immediately to the client app with a new token.
It depends on the IDP session existence/timeout again
Essentially an Identity Provider authenticates users and decides how to do that. It can prompt for credentials but can also create and maintain authentication sessions for the user for (typically) a limited period of time which allows for true Single Sign On (SSO).
Also note that this behaviour does not depend on the exact protocol at hand (OpenID Connect, OAuth or even SAML): it would work the same for any protocol that redirects a user to an Identity Provider in a federated SSO system.
In OpenID Connect, the session at RP typically starts when the RP validates End-User's ID Token. ID token consists of expiration time. So if the user just leaves (not logged out) and the id_token is expired when he access the RP, then the end-user needs to re-authenticate.
If the end-user logged out from the relying party and the OpenID provider supported logout mechanisms such as OIDC session management, OIDC front-channel logout or OIDC back-channel logout, then all RPs sharing the same browser session will be logged out (SLO). Then the end-user needs to login to the OP again to access the RPs.

Spring security SAML : Own login page instead of ADFS login redirect

After spending good time in Spring security with SAML for ADFs login , I am became fan of framework.
I was able to integrate my web application with ADFS for login. But I am missing few requirement here :
1) When we select IDP ADFS login url on my web application login page ,it is moving out of my web application to ADFS login. Which is not desire behavior for business.
2) Also faced problem that , as on successful login user object sent back to my web application from ADFS but in case of login failure it is staying on ADFS login page with login error message.
With this requirement can you please guide me for below requirements.
1) I want to use my own login page (instead of ADFS login redirect) to capture the username and password
2) Pass on those credentials to ADFS server for authentication
3) User authentication flow:
3.a Once user is authenticated, then redirect user to success page
3.b If authentication failed then redirect user to error page. ( Getting failure response from ADFS)
The core idea of SAML-based single sign-of is to decouple system which authenticates users (IDP - identity provider) from the systems which receive information about user's identity without performing the authentication (SP - service providers).
This model implies that SP does not have access to user's credentials, and therefore cannot contain a traditional login screen with username/password.
You can find more details e.g. in wiki of SAML 2.0 Web SSO
Yes, We can do this if IDP provides the authentication API. Okta IDP provides such API.
Check this:okta authentication api

Resources