Enabling Custom Authentication for SharePoint 2007
You are all set to go, except for one big hole. SCAW, which is nothing but a SharePoint Web application, has no idea about the "LocalSqlServer" you are supposed to use. Out of the box, it will try to use the default SQL Server Express under App_Data. That will not workyou want SCAW to connect to the SQL Server you set up at the beginning of this article.
To make sure that SCAW can understand your LocalSqlServer, find the connection strings you put in the web.config for http://localhost and add the connectionStrings section as before to the web.config for SCAW's home directory. Also, ensure that in SCAW's web.config, the PeoplePickerWildCard's section has an entry for AspNetSqlMembershipProvider.
Now, back in SCAW's Central Administration -> Application Management area, click "Site collection Administrators" under SharePoint site management as shown below:
Specify "smartdude" as the primary administrator for the site collection at http://localhost and "dumbdude" as the secondary administrator as shown below:
If you had not specified the LocalSqlServer settings earlier, you would probably see a red squiggly line under the username because SharePoint would not be able to find the user called "smartdude" and it could not connect to the database you specified.
You are all set. Fire up the browser and go to http://localhost.
Using the Application with Custom Authentication
When you browse to http://localhost, you are greeted by a forms-based login page that is a part of SharePoint 2007. You could customize this page or use a custom login page, but that is beyond the scope of this article.
Sign in as shown below:
Once logged in, notice that SharePoint now natively understands your custom authentication mechanism. The global toolbar features "smartdude", not a Windows login as shown below:
Congratulations! You now are using SharePoint 2007 under forms-based authentication. This is something you couldn't achieve in SharePoint 2003.
A Note of Practical Consideration
Being able to plug in any kind of authentication is a huge leap for SharePoint. However, a number of binaries such as SharePoint Designer 2007 are hard-wired to use Windows Authentication instead. If you try opening http://localhost in SharePoint Designer 2007, you will probably be greeted by the following message:
This is not such a huge stumbling block, however. You probably do not want to connect SharePoint Designer 2007 to your production Web site anyway. Instead, you still could enable Windows authentication on a development Web site and enforce consistency between the two using site definitions and site templates. For newer applications that need to work with SharePoint 2007 using the new authentication mechanism in production, you can specify custom credentials using WCF or WSE 3.0 anyway.
About the Author
Sahil Malik (www.winsmarts.com) has worked for a number of top-notch clients in Microsoft technologies ranging from DOS to .NET. He is the author of Pro ADO.NET 2.0 and co-author of Pro ADO.NET with VB.NET 1.1. Sahil is currently also working on a multimedia series on ADO.NET 2.0 for Keystone Learning. For his community involvement, contributions, and speaking, he has also been awarded the Microsoft MVP award.
Page 2 of 2