Skip to content

Hints for Membership Providers (Authentication Providers) with SharePoint

I’ve done work with membership providers more than a few times now and I have developed a love-hate relationship with them within the context of SharePoint.  It’s not that membership providers don’t work.  They do.  You can absolutely make them work.  However, it’s also true that there are a lot of landmines in the way.  I wanted to provide a few of my experiences with Membership providers that may be helpful for you…

  1. Don’t start with SharePoint – If you’re going to work with Membership Providers in SharePoint – don’t start there.  Build a simple ASP.NET application that has a secure home page.  Make a login page.  Test your membership provider and its configuration settings in ASP.NET first.  Why?  There are less moving parts.  You can run an ASP.NET web site in debug mode by pressing F5.  You don’t have to deal with all of the other things that are going on inside SharePoint.  The fact that first chance exceptions work in ASP.NET (they don’t in SharePoint) you can try to capture the exceptions as they happen.  (If you don’t know about First Chance Exceptions you can go here.)
  2. Build a Shell – Even if you’ve tested the membership provider in ASP.NET there are reasons why SharePoint is different.  Instead of running with the local account you’re running within the context of the application pool.  Because of this you need to be able to see what’s happening between SharePoint and the Membership Provider.  You may need to see all of the call parameters and the return values – and even the exceptions.  So build yourself a passthrough provider which will log the calls, the responses, and the exceptions.  It will make figuring out what’s happening much easier.  (I have a version.  If you want a copy send me an email and I’ll send you a copy of it.  Better yet, if you’re willing to help review it and get it up on CodePlex let me know.)
  3. People Picker is Evil – The people picker is evil.  You’re supposed to be able to specify the provider to use when selecting a user (myProvider:TheUser).  Sometimes that actually works.  It works if you’re in the zone where the provider is the default, but doesn’t always work outside of that.  Add to the problems with the People Picker that you need to remember to add the search wildcard to the entry in the web.config.  So if you are getting stuck adding permissions… start with adding a Policy for the Web application (see Steve Peschka’s post on the SharePoint Products and Technologies team blog titled “Configuring Multiple Authentication Providers for SharePoint 2007”)
  4. Don’t ask everything of the membership provider – One of my clients wanted to login via email address in active directory – and not their UniquePrincipalName.  Although this is technically possible by using the LDAP provider, that may not be the best answer.  It may make more sense to modify the login page rather than trying to get the membership provider to log in on a field other than the ones that it’s used to logging in with.  In fact, on a scale of difficulty modifying the login page is must easier than mucking with membership providers.  I’ve got a forthcoming article on how to create a custom login page for SharePoint. I’ll add a link here when the article goes live.

 

Help Your SharePoint User

Good luck on your work with membership providers…

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: