A while back, I posted an article on how to create a SharePoint membership provider for Oracle’s Internet Directory (LDAP). The post continues to be a relatively popular post and more than a few folks have asked for the source directly.
While I’ve generally tried to e-mail the membership class directly to anyone who requests it, simply posting it to the Consejo blog is probably easier on everyone.
Here’s a TXT version of the C# class. While I’ve refactored subsequent versions of this class a few times, this version is still pretty raw, but functional (read: it’s a good start if you have nothing). In this version, I used Kellerman’s Encryption Library to handle the MD4/MD5 hash format used by my client’s directory; interestingly they used one method for their test environment and one for their production environment. While the Kellerman library is quite affordable (and easy to use), there is an open source alternative on CodePlex called .NET Crypto (Devv.Core.Crypto) as well as Microsoft’s Enterprise library, which include cryptography functions.
Other notes on the code:
- If you have a MOSS implementation, you don’t need this class. Microsoft provides an generic LDAP provider with the full server product. This was written for those who only have WSS and need something custom.
- The original requirements for this class were for creating a single sign-on environment between an Oracle Portal and SharePoint (sign on to the Oracle portal and get straight in to SharePoint without authentication). As such, I didn’t write any code to handle password changes, resets or other management functions, since those would all be handled by Oracle’s product interfaces.
- I’ve only overloaded the bare minimum necessary for the membership provider to work with SharePoint (see above bullet).
- The lookup function for users requires exact matches. In hindsight, I could have implemented the query a bit better to improve operation with the People Picker component in SharePoint; I didn’t, but hopefully you will and share it with the rest of us…
- This was originally written for WSS v3.0, but there’s no reason, with potentially minor changes, it couldn’t work for SharePoint Foundation (2010). If you get it to work in a 2010 environment, I’d love to see the implementation and hear your experiences.