IT tutorials
 
Technology
 

Sharepoint 2013 : Authentication and authorization infrastructure (part 3) - Configuring FBA with SQL Membership Provider

9/17/2013 7:50:33 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

3. Configuring FBA with SQL Membership Provider

In this section, you will learn how to configure a SharePoint 2013 web application to support FBA against a SQL Server database. The process involves configuring and creating a SQL Server database, changing the web.config file of the target web application, SPCA, and SharePoint STS, configuring SQL Server permissions, configuring SharePoint, and enabling users and roles in SharePoint.

Configuring the SQL Server database

To configure SharePoint to support FBA with SQL Membership Provider, you first need to create a SQL Server database file that supports your environment. To help you, ASP.NET provides a tool called ASPNET_REGSQL.EXE, which is available in the Microsoft .NET Framework folder. You invoke ASPNET_REGSQL.EXE within the Microsoft Visual Studio command prompt, and it creates a SQL Server database file. The tool is organized as a wizard (see Figure 4) with four main pages:

  • Welcome screen . There is nothing more to do here than simply click the Next button.

  • Select A Setup Option . On this page, you select whether to configure a new database or to remove an existing one. Choose the Configure SQL Server For Application Services option.

  • Select The Server And Database . Here, you select the target SQL Server database server where the database file will be created, together with the authentication method that will be used to communicate with the server, and the name of the database file that will be created.

  • Confirm Your Settings . This is simply a summary of your settings.

A screen shot of the Select The Server And Database page of the wizard for creating a Membership and Role Provider back-end database. There are fields to configure the database server, authentication method, and target database name.

Figure 4. The Select The Server And Database page of the ASPNET_REGSQL.EXE wizard.

Note

To learn more about FBA with a SQL Server database on the back end, consult http://www.microsoft.com/en-us/download/details.aspx?id=34684.

After you create the database, you need to configure some users and groups to use in SharePoint. For this purpose—and for the sake of simplicity—you can create a new ASP.NET Empty Website project in Visual Studio.

Important

Remember that SharePoint 2013 is based on.NET Framework 4.5. Therefore, your website should be created using the same target version of .NET Framework to avoid issues with varying assembly versions.

You can configure the website by going to Project | ASP.NET Configuration, which brings up the ASP.NET Web Site Administration Tool. This is a well-known tool with which every ASP.NET developer should be familiar. From there, you can use the Security Setup Wizard to configure your site for supporting FBA using the previously created SQL database. You can also manually configure the web.config file, if you like.

More Info

If you are not familiar with the Web Site Administration Tool site, see the document “Web Site Administration Tool Overview,” which is available on MSDN at http://msdn.microsoft.com/en-us/library/yy40ytx0.aspx.

The web.config file of the sample site for configuring FBA in Visual Studio

<configuration>
<connectionStrings>
<add name="SharePointFBA" connectionString="server=SP2013SQL;database=SP2013_Farm_FBA;integrated security=SSPI;"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms" />
<authorization>
<deny users="?"/>
</authorization>
<membership defaultProvider="FBASQLMembershipProvider">
<providers>
<add connectionStringName="SharePointFBA" applicationName="/"
passwordAttemptWindow="5" enablePasswordRetrieval="false"
enablePasswordReset="false" requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Hashed"
name="FBASQLMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=4.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="FBASQLRoleManager">
<providers>
<add connectionStringName="SharePointFBA" applicationName="/"
name="FBASQLRoleManager"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
</system.web>
</configuration>

Note

The type attribute values, as well as the connectionString attribute, in the preceding listing should appear on a single line in your code. They’re wrapped here due to typographic constraints.

These configuration elements will be useful when configuring SharePoint 2013 for FBA. While you’re in the Security Setup Wizard, you can also configure some users and groups, for testing purposes. The following roles have been created:

  • Admins

  • Managers

  • Users

In addition, the following users have been created:

  • SampleAdmin01

  • SampleManager01

  • SampleUser01

As their names imply, each user belongs to the corresponding role. For example, you can give them a password value of Passw0rd!. You should test your authentication infrastructure by writing a couple of sample pages for logging in and logging out.

Configuring SharePoint web.config files

Now that you have a working configuration for you site, you are ready to apply that configuration to SharePoint. First, you need to locate the web.config file of the web application where you will configure FBA. By default, the root folder of a SharePoint web application is located in the C:\inetpub\wwwroot\wss\VirtualDirectories folder of every front-end server.

Note

For the sake of simplicity, if you are working in a lab environment, you could create a new web application by using SPCA or PowerShell, and configure it with the following steps. Otherwise, in a production environment, you should locate the web.config file of the real target web application.

Next, you need to copy the connectionStrings/add element that defines your SQL Server membership database into the connectionStrings element of the target web.config file. Be careful while editing the web.config file, and make a backup copy of it before applying any kind of change. If the connectionStrings section is missing, you must create it from scratch, adding it after the configSections element of the web.config file, as shown:

<connectionStrings>
<add name="SharePointFBA" connectionString="server=SP2013SQL;database=SP2013_Farm_FBA;integrated security=SSPI;"/>
</connectionStrings>

Then you need to locate the Membership and RoleProvider sections, within the system.web section of the target web.config file. There, you need to copy only the providers’ configuration, without changing the default providers that were already configured by SharePoint. The result should look like the following:

<membership defaultProvider="i">
<providers>
<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SharePointFBA" applicationName="/"
passwordAttemptWindow="5" enablePasswordRetrieval="false"
enablePasswordReset="false" requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Hashed"
name="FBASQLMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.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=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SharePointFBA" applicationName="/"
name="FBASQLRoleManager"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>

Note

The type attribute values in the preceding listing should appear on a single line in your code. They’re wrapped here due to typographic constraints.

In the previous example, the code highlighted in bold shows that SharePoint 2013 already has a default membership provider named i and a default role provider named c. These are the providers that manage the claims-based infrastructure.

After you have configured the web.config file of the target web application, you need to configure the web.config file of the SPCA web application in the same way, as well as the web.config file of the internal SharePoint STS. The SPCA web application must be configured so that you can manage users defined in the FBA database from within the administrative pages, as well. You can still find its web.config file in a folder in the C:\inetpub\wwwroot\wss\VirtualDirectories path of every front-end server. The STS web application needs to have access to the FBA database in order to retrieve claims and information about the authenticated users during identity normalization. You can find the STS service of SharePoint and its web.config file in the SharePoint15_Root\WebServices\SecurityToken folder.

Configuring SQL Server permissions

To take full advantage of the authentication infrastructure that you have just configured, the application pools of SharePoint need to have access to the SQL Server database you configured for FBA. Thus, you need to properly configure the database’s permissions. This is a simple but fundamental task. To carry it out, you need to enable the Windows identities configured for the following:

  • The SPCA application pool

  • The STS application pool

  • The application pool of the target web application

All three need the following database role memberships:

  • aspnet_Membership_FullAccess

  • aspnet_Roles_FullAccess

Configuring SharePoint

You are almost done. Now you simply need to configure the FBA providers—for example, through the SPCA interface. To access the list of available web applications, click Application Management, then click Manage Web Applications, and then choose the FBA target. On the ribbon, click the Authentication Providers command, and in the window that appears, click the Default Configuration link. The Edit Authentication configuration page will open.

Select the Enable Forms Based Authentication (FBA) check box, and provide the name for the membership provider and role provider to use. Figure 5 shows the configuration dialog box, completed with information based on the current sample scenario.

A screen shot of the UI for configuring an FBA provider for membership and role. It includes a couple of text fields for providing the membership provider and the role provider.

Figure 5. The Edit Authentication configuration page of SPCA.

Enabling FBA users or roles

The last step in configuring FBA is to enable some users or roles to access the site collections defined in your target web application. You can accomplish this task either from SPCA or from the People And Groups page of the target site.

Notice that if you now try to browse for users or roles, you will be able to browse both Windows and FBA users within the same browsing windows. From the perspective of SharePoint 2013, all the users are claims identities, regardless of the authentication provider that was used. Notice how searching for users in Figure 6 returns one result in the role repository of FBA and three more results in the security groups of Windows.

A screen shot showing how SharePoint searches for groups and roles in FBA and Windows when both are configured. A drop-down list of the search results for the group or role with the name Users displays four results: a role from FBA and three groups from Windows/Active Directory.

Figure 6. The Share dialog box with multiple authentication providers configured, during a search for users.

 
Others
 
- Sharepoint 2013 : Authentication and authorization infrastructure (part 2) - Claims-based authentication types
- Sharepoint 2013 : Authentication and authorization infrastructure (part 1) - Authentication infrastructure
- Windows 8 : Managing Disk Compression and File Encryption (part 2) - Encrypting Drives and Data
- Windows 8 : Managing Disk Compression and File Encryption (part 1) - Compressing Drives and Data
- Windows 8 : Managing Disk Drives and File Systems - Working with Removable Storage Devices, Working with Data Discs
- Sharepoint 2010 : Business Connectivity Services - The BCS Object Model
- Sharepoint 2010 : Business Connectivity Services - BCS with Visual Studio 2010
- Sharepoint 2010 : Business Connectivity Services - BCS and SharePoint Designer
- Windows Phone 8 : Services - Consuming OData (part 2) - Generating a Service Reference for OData, Retrieving Data, Updating Data
- Windows Phone 8 : Services - Consuming OData (part 1) - How OData Works, The URI
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us