Thursday 7 March 2013

How to Enable FBA in Sharepoint 2010


Create a site using Claims Authentication or convert existing a site which is using windows

authentication to claims authentication. By using following Power shell script.
      
$App = get-spwebapplication “http://sp1:8000”
          $app.useclaimsauthentication = “True”
          $app.Update()
type avobe script in to notepad and save some where in suppose in c drive.
Now open power shell and type
./filename.ps1

Now we have a site which uses claims based Authentication.

2.       Configure Member ship provider and role  manager data base in sql .
On command prompt go to C:\windows\microsoft.net\framework\latest frame work.
And type astnet_regsql.exe.  it will open a dialog box for configuring Member ship database
Enter the names of  Membership Provider , Role Manager , Membership Database.
Whatever name can be used Just remember these names  .
3.       Now data base has been configured ad some users in it here is a tool  on code plesk . extract open bin folder . run exe file . if data base is other than aspnetdb then open config files and change to appropriate database name.
4.       Modify web.config files to update these data base . three web.config files has to be updated .
a.       Web.config of Content Site.
b.      Web.config of central administration
c.       Web.config of web  services token.
a.        paste connection string information after </ Sharepoint>  and before <system.web>
<connectionStrings>
<add name="SQLConnectionString" connectionString="Data Source=.;Initial Catalog=Membershipdb;Integrated Security=True" />
</connectionStrings>

Paste bellow code in before </System.web>
<membership defaultProvider="i">
      <providers>
<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
    <roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false">
      <providers>
 <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
               
<add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
    </roleManager>
Web.config of Central Administration .
Backup before changing.
Add the connection string after </sharepoint> and before </System.web>
<connectionStrings>
<add name="SQLConnectionString" connectionString="Data Source=.;Initial Catalog=Membershipdb;Integrated Security=True" />
</connectionStrings>

Add membership provider and role manager in the provider section of both respectively. Focus on highlights
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">

              <providers>

                    <add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

              </providers>

        </roleManager>

        <membership defaultProvider="SQL-MembershipProvider">

              <providers>

                    <add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

              </providers>

        </membership>
Above will be in System.web section in web.config.


Web.config of STS


Explore STS From IIS Manager.
 Backup before changing.

Before </Configuration> and
<connectionStrings>

                                <add name="SQLConnectionString" connectionString="Data Source=.;Initial Catalog=Membershipdb;Integrated Security=True" />

                </connectionStrings>

                <system.web>

                                <roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false">

                                                <providers>

                                                                <add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

                                                                <add connectionStringName="SQLConnectionString" applicationName="/" description="Stores and retrieves roles from SQL Server" name="SQL-RoleManager" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

                                                </providers>

                                </roleManager>

                                <membership defaultProvider="i">

                                                <providers>

                                                                <add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

                                                                <add connectionStringName="SQLConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" description="Stores and Retrieves membership data from SQL Server" name="SQL-MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

                                                </providers>

                                </membership>

                </system.web>
Keep Highlighted points in mind.

Save and reset the IIS and you are done.

please Read next Post to Read how to enable FBA in Sharepoint 2013 .

No comments:

Post a Comment

Setup dev environment for spfx

So lets setup dev environment for SharePoint Framework abbreviated as SPFX. for an Introduction of What is SPFX and What are the capebiliti...