Re: [Mono-dev] [PATCH] ActiveDirectoryMembershipProvider

2007-04-04 Thread Miguel de Icaza
Hello,

> 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?

Your patch looks correct, and since the MonoTODO is kept there, it will
be useful as a reference to others in the future.

Miguel.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] ActiveDirectoryMembershipProvider

2007-04-04 Thread joel reed
By the way, here's what the exception looks like without this change:

System.TypeInitializationException: An exception was thrown by the type 
initializer for System.Web.Security.Membership ---> 
System.ArgumentNullException: Argument cannot be null.
   at System.Configuration.Provider.ProviderCollection.Add 
(System.Configuration.Provider.ProviderBase provider) [0x0]
   at System.Web.Security.MembershipProviderCollection.Add 
(System.Configuration.Provider.ProviderBase provider) [0x0]
   at System.Web.Configuration.ProvidersHelper.InstantiateProviders 
(System.Configuration.ProviderSettingsCollection configProviders, 
System.Configuration.Provider.ProviderCollection providers, System.Type 
providerType) [0x0]
   at System.Web.Security.Membership..cctor () [0x0] --- End of 
inner exception stack trace ---

jr

joel reed wrote:
> 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.0 -0400
> +++ 
> mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs 
> 2007-04-03 20:59:50.0 -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
> 
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [PATCH] ActiveDirectoryMembershipProvider

2007-04-03 Thread joel reed
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.0 -0400
+++ 
mcs/class/System.Web/System.Web.Security/ActiveDirectoryMembershipProvider.cs 
2007-04-03 20:59:50.0 -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
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list