Saturday, August 22, 2009

How to create for Forms Authentication for SharePoint?

Create Database:
First step is to create membership database to save users and their credentials. To create membership database follow steps given below:
1. Open “%windir%\Microsoft.Net\Framework\vx.x.xxxxx” folder. Run aspnet_regsql.exe.
2. And complete the wizard steps(Select Configure SQL Server for application services option from the wizard).
3. Once wizard completed membership database has been created.

Configure Membership Providers:

This will allow us to add the users and roles into the database. To create user and role in database follow steps given below:
1. Create a new web site.
2. Add connection string in web.config file shown below

<connectionStrings>
<remove name="XX_ConnectionString" />
<add name="XX_ConnectionString"
connectionString="Integrated Security=SSPI;
Data Source=<SQLServerName>;Initial Catalog=<DatabaseName>;"
providerName="System.Data.SqlClient" />
</connectionStrings>

3. Now next specify the membership and role providers in the web.config file under <system.web> tag like shown below

<membership defaultProvider="XX_AspNetSqlMembershipProvider">
<providers>
<add connectionStringName="XX_ConnectionString"
passwordAttemptWindow="20"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression=""
name="XX_AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,System.Web,
Version = 2.0.0.0 ,
Culture = neutral,PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>

<roleManager enabled="true" defaultProvider="XX_AspNetSqlRoleProvider">
<providers>
<add connectionStringName="XX_ConnectionString"
applicationName="/"
name=”XX_AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>

4. Then used ASP.Net Configuration Wizard to create Role and Users.

MOSS People Picker cannot search Domain users

Why MOSS People Picker cannot search Domain users?
If you installed SQL server and SharePoint using local user account and not domain account, then if you are going to search domain users from the people picker, then domain user will not found from people picker.

Some work around for this:
1. Change user account for all app pool and services of SQL server and SharePoint with domain user account.
All App pool accounts(for central admin and other SharePoint web application)

2. Give access to the SharePoint database to new domain account as owner.

3. Update central admin farm credentials with new domain user account for this just need to run stsadm command.
stsadm -o updatefarmcredentials -identitytype configurableid -userlogin -password
This will update farm credentials.

4. Update SSP credentials with domain user account, Used stsadm command for change the SSP account credentails.
Stsadm.exe -o editssp -title "SSP Name" -ssplogin -ssppassword

This will update all necessary credentials for SharePoint farm, Then will get domain user from the people picker.