How to use ActiveDirectoryMembershipProvider with ASP.Net Identity? How to use ActiveDirectoryMembershipProvider with ASP.Net Identity? asp.net asp.net

How to use ActiveDirectoryMembershipProvider with ASP.Net Identity?


You don't want to mix MembershipProviders with identity. What you most likely want to do, is treat logging into ActiveDirectory similar to how identity treats other external logins (like google/facebook).

This basically boils down to storing the AD username as a login:

userManager.AddLogin(<userId>, new UserLoginInfo("ActiveDirectory", "<ADUserName>")

If you only login via AD, then you could indeed override PasswordSignIn to explicitly validate against AD

Otherwise, you'd want this in only the specific login flow for AD, preserving the existing local password/social login functionality.