Custom membership provider for MOSS site

demo.jpg

Recently I had this project where the client wanted to create their MOSS portal (of course) .. but instead of using AD for authentication they asked to create a mechanism that would allow to link all the user data to a some sort of the database and table with it’s own schema.

I assume it’s pretty common request for clients not wanting to invest in AD infrastructure/admin resources etc. Or maybe they just want a separate storage mechanism. Or maybe it’s a legacy database that already has quite big amounts of user records. Whatever the story is – you must create your own membership provider.

Custom Membership provider means that you are going to be handling all the authentication or rather user validation. But wait – user validation is not all that needs to be implemented .. you have to implement bunch of small methods handling for example : user lookup by some sorts of parameters. This article will exaplain how to write your own membership provider and install it on your site …. and essentially got things working …

So the file that we have over here:  custommemberships.zip contains project (simple class library, already signed and stuff) … that you can use to write your validation and user retrieval logic. Also, I have thrown in database scripts that will create membership database with very simple structure and scripts allowing to retrieve and validate users.

Once you compile the DLL – you need to place it in your GAC. The package above has also 2 web.config files: one for your site web.config and another is Central Administration web config.

Those files are to be placed in their appropriate directories and iisreset performed.

Don’t forget to turn on the Forms authentication with your provider name in Cenral Admin:

forms_authentication.JPG

The most important thing now is to get your site set up with Site collection administrators equal to usernames in your database from Central Administration.

site_collection_admin_assignments.JPG

This way we can log in to our new site with forms authentication and sign in as collection administrator. Once we are logged in with collection admiistrator credentials  -we can start adding users and assigning their roles.

Cheers!

Feel free to ask question if anything.

This entry was posted in MOSS, sharepoint and tagged , , . Bookmark the permalink.

Comments are closed.