locked
ASP .NET Identity with Windows Authentication and roles in database RRS feed

  • Question

  • User2073257352 posted

    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.

    Monday, March 19, 2018 8:25 AM

Answers

  • User283571144 posted

    Hi krzysiek,

    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?

    According to your description, I suggest you could try to MIX form and windows authentication in your application.

    Like this:

    Then you could write custom role manager or usermanager to get the role information from the database according to the user name.

    Mor details about how to impelement the mix-auth in asp.net, you could refer to below sample:

    https://github.com/MohammadYounes/MVC5-MixedAuth 

    https://github.com/MohammadYounes/Owin-MixedAuth 

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 20, 2018 6:00 AM

All replies

  • User283571144 posted

    Hi krzysiek,

    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?

    According to your description, I suggest you could try to MIX form and windows authentication in your application.

    Like this:

    Then you could write custom role manager or usermanager to get the role information from the database according to the user name.

    Mor details about how to impelement the mix-auth in asp.net, you could refer to below sample:

    https://github.com/MohammadYounes/MVC5-MixedAuth 

    https://github.com/MohammadYounes/Owin-MixedAuth 

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 20, 2018 6:00 AM
  • User2073257352 posted

    That's solution I've looked! Thanks 

    Wednesday, March 21, 2018 8:07 AM