Is supporting active directory in a web applicatio

2019-08-22 07:31发布

问题:

I have a web application that currently only supports asp.net forms authentication.

My user business logic currently is like:

Users.GetUserByID(userID); Users.LoginUser(username, password);

i.e. it is pretty modular and I hope supporting active directory won't be difficult.

Is it possible for me to support both AD and forms? If yes, what do I do, simply insert a new user for someone who signs into using AD for the first time?

回答1:

No the only thing you have to do is witch you membership provider with the Active Directory membership provider. However there are some major differences, the user will always come in logged in with a specific user name, so there will be no need for a username and password.



回答2:

The default provider for AD is "windows integrate authentication" and this cannot mix-and-match with forms auth. However if you decide to implement a custom provider, then you can maintain your business logic. You will have to write AD integration code. And yes, using the API for AD you can automatically add users, if you wish.