Skipping the Home Realm Discovery Page for ADFS authentication - asp.net-mvc

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?

Related

CAS endpoint for delegated authentication to external OAuth server

I have a CAS 6 instance that I'm using as a OAuth server to authenticate a Spring webapp, using the endpoints described in https://apereo.github.io/cas/6.5.x/authentication/OAuth-Authentication.html#endpoints to retrieve AT and RT. The login page is on the webapp, not on CAS.
Now I need to add social login features (Google, Facebook and Apple), but I'm struggling to understand how to configure CAS to act also as a OAuth client and manage the redirect from webapp login page to Facebook and then back to the website.
How can I call CAS so that the user is redirected to Facebook login, and then back to the website, while being authenticated obtaining an AT? Does CAS need to act as a sort of proxy?

Sign Users Out of ASP.NET Application When They Logout From Okta Dashboard

We have an ASP.NET MVC application that uses Okta for user authentication.
When an unauthenticated user browses to our app, they are redirected to Okta to log in and are then redirected back to the application, authenticated. When they click "Logout" within the application, they are signed out of the application and signed out of Okta.
The issue is when we click "Logout" from the Okta dashboard. When a user clicks "Logout" from the Okta dashboard, they are signed out of Okta but not signed out of our application. When the user logs in with different credentials in Okta and opens the application, HttpContext.User.Identity still contains the previous user information.
Is it possible to set things up such that when a user clicks "Logout" within the Okta dashboard they are also logged out of the ASP.NET application? What's the best way to accomplish this?
This is the expected behavior, let me explain.
Let's assume a user is not logged into Okta OR your application. When a user visits your application and clicks "Log In", they are then redirected to Okta to authenticate. When they authenticate to Okta, a new session cookie is created so the user's identity is remembered on the Okta domain (for example, blah.okta.com).
Then the user is redirected BACK to your application (yourwebsite.com) where they will have an access token and a NEW session cookie (on the yourwebsite.com domain) which will keep them logged in there.
So at this point, there are two separate sessions that are active:
One on your domain (yourwebsite.com)
One on Okta's domain (blah.okta.com)
When a user logs out of Okta's dashboard, this means that their token is revoked and the session cookie is deleted (from the Okta blah.okta.com domain). BUT, there is no way for Okta to delete the session cookie from YOUR website (yourwebsite.com).
Therefore, when your user does something on your website (yourwebsite.com), the user's browser will STILL send the session cookie to your backend that contains an Okta access token.
And... Depending on how your web application is configured, it will do one of two things to verify that token:
It can either validate the token locally using a JSON web token library (which is the default behavior), in which case the token is still valid, so the user is considered "authenticated" and will continue to be able doing things even though their token has been revoked.
It can validate the token against Okta's authorization server (this is called token introspection), which is a bit slower as it requires an HTTP request to Okta. If this is done, then the user will indeed be recognized as logged out and their session will be destroyed.
So basically, to get the behavior you're talking about, you need to modify the way your web application is validating the user's tokens. You need to switch from using LOCAL VALIDATION to TOKEN INTROSPECTION.
Unfortunately, we don't yet have the option to use token introspection in our ASP.NET library. The author of the library has just added that to her backlog =)

Openid Connect single sign on external web sites

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.

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