2
votes

I'm looking for solution which uses ASP .NET Identity, Windows Authentication with roles in database. I'm building intranet web app, every user has Windows account but roles should be in database because I don't want to ask admins every time I need to assing user to role.

When I'm creating new ASP .NET MVC project in Visual Studio and choose Individual User Accounts I have a lot of things, which are done e.g. in Startup class and ConfigureAuth method there is app.UseTwitterAuthentication. Is there the same for Windows Accounts? e.g. app.UseWindowsAuthentication?

Can I just authenticate user by Windows Account and map this account to my database account?

I know that I can write my custom RoleProvider, but I'm rather looking solution done like Facebook/Google/Twitter authentication. It seems to be obvious that Windows Authentication should be somewhere, isn't it?

Thanks for every help.

1

1 Answers

2
votes

Using OWIN and Active Directory to authenticate users in ASP.Net MVC 5 application passed in comment by trailmax (thanks) is one of the resolution https://tech.trailmax.info/2016/03/using-owin-and-active-directory-to-authenticate-users-in-asp-net-mvc-5-application/

  1. Choose no authentication
  2. ConfigureAuth with UseCookieAuthentication
  3. Write some kind of AdAuthenticationService
  4. Use service in Login controller

Another worth considering are https://github.com/MohammadYounes/Owin-MixedAuth and https://github.com/MohammadYounes/MVC5-MixedAuth