Custom Membership Provider sample

Topics: Technical Questions, Usage Scenarios
Mar 27, 2009 at 4:16 PM
I'm trying to figure out how to configure an endpoint to use a custom membership provider that's not a SqlProvider.  Can someone provide me with a sample XAML file that configures a custom membership provider.

Mar 27, 2009 at 4:43 PM
The Security Guide sample includes a sample service behavior called SqlProviderSecurityBehavior.  You would need to create your own version of this class to create an instance of whatever membership provider you want.

You'll need to create a complimentary wrapper class (that extends BehaviorExtensionElement) for the Xaml assertion to reference (again look at SqlProviderSecurityElement).

The classes included with the security guide aren't intended to be generic wrappers around any membership/role provider (hence their name).  However this is very possible.   Your custom BehaviorExtensionElement just needs to expose a property that allows you to specify the assembly & class name that implements the provider (which would be provided as part of the Xaml assertion).  This would be passed to your custom service behavior to create an instance and hook it up to the service credentials.

hope that helps