views:

313

answers:

3

What design pattern should I use to handle both forms authentication and active directory? (Administrative setting will allow you to chose either one of them).

From what I know, .NET membership provider only has forms right?

+2  A: 

.Net Membership lets you use Windows or Passport as well as forms authentication.

There is an ActiveDirectoryMembershipProvider. Click on "How to use forms authentication with Active Directory" in the links at the top of this page to get details.

DOK
A: 

To answer your design pattern question. On a project that had a similar situation (using two different systems for authentication), we used the Facade pattern to abstract away which system was actually doing the authentication (one or the other or even both!).

Then, within that facade, we would make the actual calls to the Authentication Providers.

Jeffaxe
+3  A: 

actually, you're probably looking for the "Strategy" pattern, since you need to implement a specific set of members (those required implement an authentication "provider"), but don't want the authentication to care HOW they are implemented. , http://en.wikipedia.org/wiki/Strategy_pattern

Facade is good, but that is applies more when you're trying to "reshape" an existing component to make it compatible with another component. Since you're implementing the providers, you don't need to "reshape" them to fit, you just implement them with the appropriate provider members in the first place..

Andrew Theken