[Mono-dev] [PATCH] ActiveDirectoryMembershipProvider

joel reed joelwreed at gmail.com
Tue Apr 3 22:09:43 EDT 2007


The patch below enhances the usefulness of 
ActiveDirectoryMembershipProvider under mono, but may not be acceptable 
for inclusion in svn. I'm posting this in case some one else runs into a 
similar problem as I encountered.

We have a Membership Provider that derives from 
ActiveDirectoryMembershipProvider and then overrides Initialize and 
ValidateUser. Our ValidateUser method looks in web.config and either 
does an validation against AD or our legacy authentication scheme.

This works on mono (if configured to not use AD), as long as the 
Initialize method in ActiveDirectoryMembershipProvider calls 
base.Initialize. Calling base.Initialize is important as this is how 
ProviderBase sets the Name property which lets the Provider be put into 
a ProviderCollection. Without the Name, Adding the provider to the 
collection fails with a ArgumentNullException.

Currently ActiveDirectoryMembershipProvider just does a "throw 
NotImplemented".

If instead we said:

mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs.orig 
2007-04-03 20:59:32.000000000 -0400
+++ 
mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs 
2007-04-03 20:59:50.000000000 -0400
@@ -118,7 +118,7 @@ namespace System.Web.Security {
  		[MonoTODO("Not implemented")]
  		public override void Initialize (string name, NameValueCollection 
config)
  		{
-			throw new NotImplementedException ();
+			base.Initialize(name, config);
  		}
  		
  		[MonoTODO("Not implemented")]

The class would be slightly more useful in the above scenario. Probably 
this circumvents some policy about MonoTODOs, but again just want to 
post this info somewhere for others to google. It might even improve 
things just by calling base.Initialize and then throwing, as you could 
catch that exception and still be in business. Thoughts?

jr



More information about the Mono-devel-list mailing list