FBA on Share Point

Embed Size (px)

Citation preview

  • 8/7/2019 FBA on Share Point

    1/19

    Setting up ASP.Net 2.0 Forms Authentication User and Role Data Source

    This section explains creation of database which is used to store user's information such ascredentials and roles which is used for Form Authentication. This section also explains theconfiguration of Membership and Role providers in the web.config file and creation of usersusing ASP.Net configuration wizard. This article shows creating a user and which will beused for testing Form Authentication later.

    Create Database

    To create database, Microsoft has provided a tool/utility called aspnet_regsql.exe thatcreates a database for us. This utility can be found in%windir%\Microsoft.NET\Framework\v2.0.50727 folder. Please see the imagebelow:

    Executing aspnet_regsql.exe file will open ASP.Net SQL Setup wizard that will walk throughcreating the ASP.Net 2.0 database. I have added the database name as SPSFormAuth andconfigured it for windows authentication. Please see the image below:

  • 8/7/2019 FBA on Share Point

    2/19

    Click on Next button. Please see the image below:

  • 8/7/2019 FBA on Share Point

    3/19

  • 8/7/2019 FBA on Share Point

    4/19

    It will show the summary screen and click the Next button. Please see the image below:

  • 8/7/2019 FBA on Share Point

    5/19

    Click Next button. Now the database SPSFormAuth is created successfully. Please see theimage below:

  • 8/7/2019 FBA on Share Point

    6/19

    Configure Membership and Role Providers

    In the previous section, database is created successfully. Now we need to add a user in todatabase. Using ASP.Net Configuration Wizard, users can be added the database. This canbe achieved by creating web site that will allow us to add the users and roles and alsoensure the database connection strings, membership and role providers are correctlyconfigured before we bring SharePoint in to equation.Below steps explains creating web site and configuring membership and role providers andexecuting ASP.Net Configuration Wizard.

    1) Open Visual Studio 2005 and select File New Web Site. In the New Web Sitedialog, select the ASP.Net Web Site template and enter the location to store the website files. Please see the image below:

  • 8/7/2019 FBA on Share Point

    7/19

    2) Add a new web.config file to web site project. Please see the image below:

  • 8/7/2019 FBA on Share Point

    8/19

    3) By default, you will see a node within node.Specify the connection string to the database which has been created in the previoussection. Please use the example given below:

    4) After setting up the connection string, we need to specify the membership and roleproviders in the web.config file. In this article, I am using ASP.Net SQL Membership andRole providers. So specify the provider's information within the tag.Please use the example given below:

  • 8/7/2019 FBA on Share Point

    9/19

    5) Save web.config file and launch the ASP.Net Configuration Wizard by clickingon Website ASP.Net Configuration. Please see the image below:

  • 8/7/2019 FBA on Share Point

    10/19

    6) Set the authentication type in the above wizard. To do this, click Security link. In

    the Security tab, under Users section, click Select authentication type link.Select From the internet option and press Done button which is available in thebottom right corner. By selecting this option, which means that site will use formauthentication to identify users. Please see the image below

  • 8/7/2019 FBA on Share Point

    11/19

  • 8/7/2019 FBA on Share Point

    12/19

    7) To test the membership and role providers, click on Provider tab. In the Provider tab,click on Select a different provider for each feature (advanced) link. Select right /correct membership and role provider and click Test link to ensure that providers arecommunicating to right database.

    At this point, we configured web.config file with connection string and providersinformation. Also we tested the providers with the database. Next section will explainadding users to database.

    Create a User

    1) To add users, click on Security tab. In Security tab, under Users section, click Createuser link. Here I am adding user as testFBA and password as password which will beused for testing form authentication later. Please see the image below:

    Creating Web Applications

    This section explains creating web application using SharePoint Central Administration. Inthis article I am creating two, sites; one is extranet site which will be used by the contentowners and configured to windows authentication. Another site is internet site specificallyfor internet users and configured to form authentication. Below section explains creating oftwo sites.

  • 8/7/2019 FBA on Share Point

    13/19

    Creating extranet IIS Web site

    1) Click Start All Programs Microsoft Office Server Central Administration.2) In the Application Management tab, under SharePoint Web Application

    Management section, click Create or extend Web application link.

    3) In Create or Extend Web Application page, click Create a new WebApplication link. Provide the information to create new web application and

    click OK button. Please see the image below.

  • 8/7/2019 FBA on Share Point

    14/19

  • 8/7/2019 FBA on Share Point

    15/19

    4) Create site under the above web application. To do this, in ApplicationManagement tab, under SharePoint Site Management section, click Create site

    collection link.5) In Create Site Collection page, select the web application which have been created in the

    previous step and provide other information to create the site and click OK button.Please see the image below.

  • 8/7/2019 FBA on Share Point

    16/19

  • 8/7/2019 FBA on Share Point

    17/19

    Now we created the web application and site successfully. Next section explains creatinginternet site.

    Creating internet IIS Web site

    This section explains extend our web application to another internet site which has beencreated in the previous sections. This site is for anonymous or internet users.

    1) Click Start All Programs Microsoft Office Server Central Administration.2) In the Application Management tab, under SharePoint Web Application

    Management section, click Create or extend Web application link.3) In Create or Extend Web Application page, click Extend an existing Web

    application link. Provide the information to extend the web application andclick OK button. Please see the image below.

  • 8/7/2019 FBA on Share Point

    18/19

  • 8/7/2019 FBA on Share Point

    19/19

    Now we have successfully created extranet and internet site. Below is the URL for thesesites.

    For extranet site: http://moss2007:36024/sites/fba/default.aspxFor internet site: http://moss2007:36025/sites/fba/default.aspx

    Open the browser and test both the site by typing the URL. But these two sites are asking

    about windows authentication because these sites are not yet configured to formauthentication.Below section explains configuration of web.config file of each site with connection stringand providers information.

    Configure Web App to communicate with Form Authentication Data Store

    In this section, we are modifying the web.config file of two sites. Web.config file resides inthe root directory of the site i.e. c:\Inetpub\wwwroot\wss\Virtual Directories. Underthis, two folders i.e. 36024 and 36025 are available. Web.config file of specific site isavailable inside these folders.

    Configure web.config file of extranet site

    The web.config file of extranet site is available inc:\Inetpub\wwwroot\wss\VirtualDirectories\36024folder.

    1) Open web.config file, specify the node defined in thesection 2.2.c just after the closing tag and opening tag.Please see the image below:

    2) Add the membership and role provider node which is defined in the section 2.2.d, justafter opening the tag. Please see the image below

    3) Save the web.config file.Configure web.config file of internet site

    The web.config file of internet site is available inc:\Inetpub\wwwroot\wss\VirtualDirectories\36025folder.

    1) Open the web.config file and follow the same step specified in the Section4.12) Here we need to very careful while specifying defaultProvider information for Role

    Provider. In the Role Manager attribute, add AspNetWindowsTokenRoleProvider asdefaultProvider. This is necessary because Central Administration still uses WindowsAuthentication for the role provider. Please see the image below:

    3) Save the web.config file.