20 July 2009

Form Based Authentication in SharePoint


(A Step Wise Implementation of FBA in SharePoint)
Here I’m adding this article to implement and extend the existing portal and have accessibility using Form Based Authentication. The article below has step wise implementation from scratch.
--
1. Create SQL Database: using Visual Studio 2005 command Prompt.

2. Use command : ASPNET_REGSQL



3. Please Select “ Configure SQL Server for Application Services
4. Enter the Server Name Authentication and the Database Name

(Please Add the Database Name of our choice :ex-newFBADatabase)


5. Continue till > finish.
6. Check Newly Created Database containing necessary tables and store procedures


7. Extend your web application in any of the prescribed zone (Internet, intranet, extranet, Custom)

a. The original web application is at port 333 (in this case).
b. We have extended to port 332 as shown and selected the zone as extranet.


8. Now In visual Studio (VS) create a web site and add following entries in web.config file.

<!--SQL CONNECTION STRING-->

<connectionStrings>
<
add name="FBAConnectionString" connectionString="Data Source=MYDATABASE;Initial Catalog=FBAUSERS; Integrated Security=True"/>

</connectionStrings>
<system.web>

<!--
Membership Provider For FBA -->


<
membership defaultProvider="FBADemoMember">

<providers>

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

</providers>

</membership>

<!-- role provider For FBA -->

<roleManager enabled="true" defaultProvider="FBADemoRole" >

<providers>
<
add connectionStringName="FBAConnectionString" applicationName="/" name="FBADemoRole"
type="System.Web.Security.SqlRoleProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager >




9. Select website > ASP.NET configuration in VS



10. Select Security hyperlink



11. Create Roles as needed.






12. Create Roles (Inside Create or Manage Roles)



13. Create Users
14. Create Users(Inside Create Users)




(~) From Central Administration
15. Select Authentication Provider in Application Security in central admin



16. Select the Web Application and select the extended Zone for FBA.


17. Select Authentication Type :
a. FORMS,
b. Membership Provider Name : same membership defaultProvider as in web.Config
c. similarly for Role Manager Name: roleManager defaultProviderd.

Enable Anonymous Access optional (depends on requirement)




18.Now Update the Extended Web Application Web.Config Place beneath <>tag in both (original and extended web application) web.config file. Also place & beneath in conjunction with connection string as shown below.



19. Add the FBA User in the original portal/Web Application through People and Groups.


20. Add user in the Defined Role/Groups As you can observe here the user will be present as FBADemoMember:

21. Now Login in the extended Site.
22. Bingo- Welcome the FBA users.



Thanks…..








2 comments:

  1. Hi,
    I found Many facing problem when a FBA User Database is created and users created in this database fails to retrieve at FBA people & group, this occurs when the FBA user Database Varies from the SharePoint Office Server DB.
    -
    The remedy to this Problem is we need to provide Owner Rights to the FBA DB same ownership as its governed to the SP DB.

    ReplyDelete
  2. Hi Akshay,

    Have you tried FBA alongwith Claims Based Authentication. I'm facing issues related to that. If you have worked on it kindly let me know.

    Regards,
    Dheeraj

    ReplyDelete

Thanks for your valuable comments

Rate Now: