ADFS implementation in existing asp.net mvc application - c#

We have existing mvc application with episerver cms 10. That application performs well. But we now have requirement to implement adfs in existing application.
I checked different links on internet regarding this. I can see that it is straight forward for new application but can't find clear guide on how to implement it with existing application. We have lot of existing users in website using sql server membership and ad authentication. How it will behave with ADFS?
Please provide me correct guide and links for this?

I'm guessing you want to continue to use both SQL users and AD users(?).
First migrate to AspNetIdentity as described here: https://world.episerver.com/blogs/K-Khan-/Dates/2017/10/migrate-from-sql-membership-to-asp-net-identity/.
Then you can add authentication with ADFS as described here: https://hacksbyme.net/2017/05/07/single-sign-on-to-episerver-with-adfs-using-owin/
Finally add the possibility to login with both AD users, and local SQL users: https://hacksbyme.net/2017/05/11/mixed-mode-owin-authentication-for-episerver-editors/

ADFS will only authenticate against users in AD (or with LDAP in ADFS 4.0).
To integrate this into your application, you need a client side protocol stack.
If you are using ADFS 4.0 refer this and this.

Related

.NET form authentication along side with OpenIDConnect is it possible

We have a legacy .NET WebForm Saas application that uses .NET Framework 4.7.2 and authentication logic via the legacy web form authentication against local SQL database. It tracks the authenticated session via cookie which is the standard for form authentication.
We recently have a customer who requests SSO using their Azure AD to authenticate into our application. Upon doing research around I've come up with SAML and OpenId Connect and I'm leaning toward OpenId Connect.
The challenge is while this customer uses Azure AD, another customer may use AWS AD or some still wants to use the standard login form on our login page.
Is this possible to have form authentication work along side with SSO? I'm still educating myself in SSO and it is confusing to say the least but I generally see people use an identity provider with multiple applications whereas we seems to go down the road of a single application using multiple identity providers while still support its own authentication method.
yes, that's doable. We have built a no-code/low-code solution for people to implement this. Here is a demo website. https://demo.datawiza.net/login
Click SSO at the bottom. Inputting company-a brings you an Okta login page; inputting company-b brings you to an azure ad login page.

IdentityServer4 and Seperate User Authentication Api

I am trying to make use to IdentityServer4 for authentication and authorization. We have set of new and existing applications.
At this moment in time we have:
- 1 ReactJs application - (there is no authentication as it's a new application) but it will use Implicit Flow using oidc-client
- 1 quite old Web Form application - which will possibly use Hybrid flow (I still need to figure it out)
- 2 .NetCore MVC web applications - they both will use Hybrid Flow
There are Few apis project that we want to protect using IDS4.
WebForm and MVC Applications both uses their own Web Services to talk to the some database to verify user credentials and let the user login to the application.
Eventually we want to migrate users from that existing database to a seperate User database. IdentityServer will also make use of this new User Database for SSO + Api Authrization.
I am thinking of creating a seperate api just for User Authentication (possibly AspNetIdentity as a webapi) and IdentityServer4 to communicate with this api to validate username/password? Does that seems right?
Also How do I configure IDServer4 to use Api for authentication rather than using services.AddIdentityServer().AddAspNetIdentity() which will directly talk to my AspNewIdentity database? and How to sure this api? Any samples I can find?
I had to do something like this, I found these useful
http://docs.identityserver.io/en/release/quickstarts/1_client_credentials.html
http://docs.identityserver.io/en/release/quickstarts/2_resource_owner_passwords.html
I used it to protect an api via users that came from Asp Identity.
Hope that helps.
IdentityServer4 doesn't really do users out of the box. The ASP.Net Identity integration just exists to get you up and running quickly. If you want to implement your own user store and sign in/out/up flows then you're totally free to do that however you want.
That said, I'm a fan of having the IDP own its own data - i.e. the users and their credentials. This helps keep you on the straight and narrow when it comes to not mixing authentication and authorization. The Auth in OAuth is client authorization don't forget.

authentication against ADFS, authorization against sql server

after several days of searching, reading and trial and error i definitely need some help.
The Situation:
I need to create a Web-Application using MVC where users are authenticated against an AD using ADFS. But they do not want to store the Roles and further Informations into the AD. So i need to read and store those informations somewhere else. My first thougt was to use the same infrastructure which VS sets up when i created a new Web-Application and choose "Individual User Accounts".
What i've done so far:
I created a new Projekt in VS and implemented the authentication against the AD using the ADFS (using this really helpful link(http://www.cloudidentity.com/blog/2014/02/12/use-the-on-premises-organizational-authentication-option-adfs-with-asp-net-in-visual-studio-2013/). Works fantastic.
Start eating my Keyboard because i can't get the next step done.
My Question/s:
Is this possible to authenticate users using the ADFS and retrieve further informations (like Roles, other properties (e.g. Department)) about the logged in user by using / extending the ASP.NET Identity Framework? Does someone have a nice link?
I'd be glad for any help.
No need to do the work in your web app...
You can simply have ADFS source the claim info from a SQL database.
Do Add Attribute Store..
Set Attribute store type to SQL
Enter a Display name and your Connection string
Then when adding the claim to the relying party choose a Claim type
of "... Custom Rule" and have the query you enter fetch the attributes from your DB.
There's a pretty good walkthru with more details in TechNet
The problem you have is that you have to map the AD claims to the ASP.NET Identity via some kind of primary key.
Good link here : Code! MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on (C#).
(With ADFS 4.0 (Server 2016) you will be able to use a SQL DB for authentication and authorization).

Authentication using Database Logins

I'm somewhat new to ASP.NET MVC and I hoped you can help me with authentication for my app.
I have a MVC application that needs to be authenticated using SQL Server Log Ins. This means I have to create roles and users in SQL Server, and all security permissions are managed at Database level. Roles, users, and permissions aren't constant and we should be able to manage them.
Any suggestion? Is there anyway to override default behaviors of Identity to achieve this goal? What do you think is the best way to implement this need? Should I Use AD or DB Logins are fine?
Thanks in advance
Based on my working experience with diverse login mechanisms, I would like to suggest you the following route
Choose AD as your identity provider[IDP]
Register your application as an Relying Party [RP]
Get the federation metadata from AD to set up your application
In case you have your AD Server with ADFS 3.0, refer this link for a sample
In case of going through the OWIN Federation Middleware, it should be very easy for you with little development effort as given in this link
With ASP.Net MVC5 & Owin this task of yours should be a piece of cake
For Azure AD based samples, refer here or for first hand information, read this article

Windows Authentication SSO in ASP.NET Remote Web Application

There is a requirement to implement Single Sign On (SSO) in our website so that users accessing it from the intranet won't have to type in their credentials.
The problem here is that the website is going to be hosted on the internet, on a remote server.
Is there some way this can be done?
--EDIT--
I looked at following link:
http://en.wikipedia.org/wiki/Active_Directory_Federation_Services
And the example scenario that is mentioned in there is exactly what we require.
Here is the detailed explanation on the situation:
There is an Active Directory Domain Controller that is used to authenticate users in the intranet.
Once the user logs into the machine, and opens up the remote website, the website should somehow verify that the user is already logged into the intranet using AD credentials and automatically allow access to the website.
Also, the website is supposed to be getting a Security Token that can be used to authenticate the user.
Of course, for example, Microsoft's way of doing that for connecting Office365 to your Intranet is called Active Directory Federation Services.
It is (as most single sign on solutions) not entirely straight forward, and it assumes a domain on your intranet, but since Office365 uses it, it is and will most likely continue to be well supported in the future.
It's just a matter of integrating your web app with the authentication provider that you are using for SSO. The details are going to vary dramatically if your using OAuth vs. Shibboleth vs. ADFS vs. etc, so there really isn't enough information in your question to give a helpful answer.

Categories

Resources