How to use Windows authentication as an alternative to password login? ASP.NET Core

464 views Asked by At

I want to implement the following functionality: I have a website I'm creating in ASP.NET Core 6 and it will be both accessible from inside and outside of the server's network.

When accessed from the outside, I only want to enable password login. But when accessed from the intranet, I want to have a button on the login page that says "Log in with Active Directory". I have a Login table in the database that has a column that has Active Directory credentials in it. So when the user presses this button, I want to lookup in the database whether the AD user is in the database, and if yes, I want to store cookies detailing which user has logged in, and from that point on I only want to use CookieAuthentication.

I have been researching this topic for only God knows how long, and haven't been able to find what I need. Negotiate auth is not good for me (by itself) because I want to treat all users from the login onwards the same, and because a User can be only authenticated with AD if the credentials are in my Login table.

0

There are 0 answers