Thursday, January 20, 2011

SharePoint 2010 FBA

After windows2008 server R2 got crashed with no point of return, I am trying to make the system come alive again with the development environment how it was, but unfortunately, I am trying this for nearly 8 days but the problems popping up again and again.

After going through various steps and procedures, I still cant get a working set of system.

Updated system with automatic updates on.
Found there .net framekwork 4 needs repair. It took some to get repaired.
After restart, when I tried to browse sharepoint site with required credentials it gave web.config error, on searhcing related to that error, it was found to apply a patch.
Downloaded patch and updated the system with it, after that its giving error of security token service is not working [securitytoken.svc couldnot be activated].
Trying to browse that service directly so as could find out whats going on.
When browse directly its saying 404 couldn't found.
When checked central admin there was a warning, which says, security token service is not available.
There is an error in eventviewer which says, port::80 cannot be shared
After restarting the system, error came as cannot find the certificate.

Disconnected the Farm using Sharepoint 2010 configuration tool.
Reconnected the Farm using Sharepoint 2010 configuration tool.

After reconfiguring and everything, the error is back at same point, security token service is not working
Uninstalled SharePoint
Uninstalled SQL Server 2008 R2.

Installed SQL Server 2008 R2.
Installed Service Pack1. { As it is mandatory. }
Applied patch KB 976761 { As Required }
Applied patch KB 970315 { As Required but not updated with this patch as it shown some error. }


Resuming on 21st Jan 2011:
Installed SharePoint 2010 perquisites
Installed SharePoint 2010
Run Configuration Wizard to create SPFarm as standalone is installing SQL Server Express, which was giving problems as we wont be having any control on FBA and our database is going to be different and we have implemented our own FBA module.

Problem occurred during configuration as the system is standalone and can't have domain account.
Prob:



Run SharePoint 2010 management shell as administrator.
Execute Command: PSCONFIG.EXE -cmd configdb -create -server neilhw2k8r2 -database sharepoint_2010_config -user neilhw2k8r2\administrator -password ******** -passphrase ******** -admincontentdatabase sharepoint2010_admincontent


Succeeded.


Resuming Configuration:
Step 1:
 Step 2:
 Step 3
 Step 4
 Step 5
 Step 6
Completed:

After Installations:
Step 1

 Step 2
 Step 3
Step 4


Configuring FBA:



Step 1: Creating a SharePoint Web Application
Next, create the SharePoint web application.

To create a SharePoint Web application

  1. Browse to the SharePoint 2010 Central Administration page.
  2. In the Application Management section, click Manage web applications.
  3. On the Server ribbon, click New.
  4. In the Create New Web Application dialog box, under Authentication, click Claims Based Authentication.
  5. In the IIS Web Site section, under Create a new IIS web site, change the Name field to SharePoint – Custom FBA.
  6. Change the Port number to 500.
  7. In the Claims Authentication Types section, do the following:
    • Click Enable Forms Based Authentication (FBA).
    • Clear other authentication modes.
  8. In the membership provider and role manager fields, type the following names exactly as shown, all in lowercase letters:
    • ASP.NET membership provider name: MSMembershipProvider
    • ASP.NET role manager name: MSRoleProvider
    We have not set up the membership and role providers yet; we will create them in subsequent steps.
  9. Change the URL to the following: http://MSCT:900
  10. Under Application Pool, select Create New Application pool : Sharepoint-80 {Default Value}
  11. In the Database Name and Authentication section, change the database name to WSS_Content_900.
  12. Leave other settings as the defaults.
  13. Click OK to create the web application.
Step 2: Configuring the Membership and Role Provider for the SharePoint Web Application
There are three web.config files that you must modify:
  • Central Administration to enable picking for site collections
  • Security Token Service to enable sign in and for issuing tokens
  • FBA Web Application to enable picking on the local web application

To configure the membership and role provide for the SharePoint web application

  1. In the web.config file for the custom FBA web application website, add the following entry inside the Providers element of the <membership> tag.

    Figure 1. Providers value for the custom FBA web application 

    1. Providers value for the custom FBA web application

  2. Add the following role manager element to the Providers element, under the <RoleManager> section, as shown in Figure 2.

    Figure 2. Role manager value for custom FBA web application 
    Role manager value for custom FBA web application
  3. Repeat the previous steps for both the Central Administration website and theSecurityTokenServiceApplication website.


     Note:
    The web.config file for the SharePoint STS website does not contain the <system.web> section. 
Step 3: Testing Forms-Based Authentication
Next, test the forms-based authentication.
To test forms-based authentication
  1. On the Central Administration website, under Application Management, click Create site collection.
  2. In the Web Application drop-down list, select the custom FBA web application,http://MSCT:900.


    Figure 3. Configuring the custom FBA web application 
    Configuring the custom FBA web application
  3. Change the title to Custom FBA Site, as shown in Figure 3.
  4. In the User name field, click the Browse icon to find the user that we added previously.
  5. Select Forms Auth on the left pane, type user1 in the search box, and then click the search button, as shown in Figure 4.


    Figure 4. Searching for user1 by using the People Picker 
    Searching for user1 by using the People Picker
  6. In the result area, double-click user1. This returns you to the site collection creation page.
  7. Click OK to create the site collection.
  8. Browse to http://intranet.contoso.com:500. You should see a logon page, as shown in Figure 5.


    Figure 5. Logon page 
    Logon page
  9. Type user1 for the username credential, and then click Sign In. (The password can be anything that you choose.)
  10. After you log on, notice that the user name in the top-right corner appears as user1, as shown in Figure 6.


    Figure 6. User name in top-right corner 
    User name in top-right corner


Few more errors during final configuration and R&D:

After modifying the web.config we get the screen as in figure below.
 Since we have provider already at root level i.e. application pools and in administration.config.
 Since it cannot access DB


Important points:
  1. Used GACutil to add the custom membership provider to global assembly cache.
  2. Added membership providers to the administration.config.
  3. Made our membership and role providers as the default providers for the Security Token Service. { It may not be required. }
  4. Make sure the user in the configuration in the config files accessing database should have permissions to access the role provider db.
  5. As we had added providers for administration.config, we need to comment those providers both in centraladmin application and webapplication. It may not be the case for doing same in some other scenario.
  6. As most of the updates had been applied earlier while trying to correct errors, those updates not required today. for e.g. hotfix for wcf etc.
This could be helpful in future references, if any required.

No comments:

Post a Comment