1

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
aburger
  • 19
  • 3
  • I've done something similar in ASP.NET (not Core), which is described here: https://stackoverflow.com/a/62219205/1202807 You may be able to replicate the same idea in Core. If you're hosting in IIS, you can still do the web.config changes I described there. The key trick is the AJAX request. – Gabriel Luci Jun 14 '22 at 19:38

0 Answers0