SharePoint 2013: Configure custom forms-based authentication provider

  • Step 1: Create the app
  1. In Central Administration, in the Application Management section, click Manage web applications.  In the Contribute group of the ribbon (upper menu), click New.
  2. In the Claims Authentication Types section of the Create New Web Application dialog box, select Enable Forms Based Authentication (FBA).
    Type a membership provider name in ASP.NET Membership provider name and a role manager name in ASP.NET Role manager name.
    For our tutorial type MyMembershipPro for the membership and leave the role manager empty.
  3. Configure the other settings for this new web application as needed, and then click OK to create it.When prompted with the Application Created dialog box, click OK.sp1
  • Step 2: Create the site
  1. In the Central Administration, Application Management click “Create site collectionssp2
  2. Make sure you choose the port created in step 1 (in our example it is port 38416), also provide a URL (in our example it is test1). Also set administration user.sp3

 

  • Step 3: Integrating your custom membership compiled provider
  1. Compile your membership provider (for example: MyMembership : ActiveDirectoryMembershipProvider)
  2. Copy the compiled dll into your SharePoint machine
  3. Register the dll into the GAC by using command line gacutil.exe -i <yourdllname.dll>
  4. Make sure it is registered by using command line gacutil.exe -l
  • Step 4: Updating the web.config
  1. You will need to update the web.config in three locations: SharePoint Central Administration v4, SharePoint Web Services\ SecurityTokenServiceApplication, Your share-point-site:sp4
  2. Open IIS click your-sharepoint-site, click explore in the right-pane, open the web.config for edit
  3. Add in the system.web section a connection string . For example name it adconn (don’t foreget to update the parts appear in green):
    <connectionStrings>
    <add name="adconn" connectionString="LDAP://YourDomain.com/DC=YourDomain,DC=com" />
    </connectionStrings>
  4. In the system.web section add/update the membership section (don’t foreget to update the parts appear in green):
    <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 name="MyMembershipPro" applicationName="MyMembershipPro" type="YourCompiledProviderNameSpace.YourCompiledProviderClass, YourCompiledProviderDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YourCompiledProvideDllPublicToken" connectionStringName="adconn" enableSearchMethods="true" attributeMapUsername="sAMAccountName" connectionUsername="YourDomainName\AdminUser" connectionPassword="Password" />
    </providers>
    </membership>
  5. Open IIS click SharePoint Central Administration v4, click explore in the right-pane, open the web.config for edit
  6. In the system.web section add/update the membership section (don’t foreget to update the parts appear in green): [Here is also a demo of the role provider you may add. If you are not using it, you may skip the roleManager part]
    <roleManager>
    <providers>
    <add name="MyRolePro" type="YourCompiledProviderNameSpace.YourCompiledProviderClass, YourCompiledProviderDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YourCompiledProvideDllPublicToken" applicationName="MyRolePro" />
    </providers>
    </roleManager>
    <membership>
    <providers>
    <add name="MyMembershipPro" applicationName="MyMembershipPro" type="YourCompiledProviderNameSpace.YourCompiledProviderClass, YourCompiledProviderDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YourCompiledProvideDllPublicToken"
    connectionStringName="LDAP://YourDomain.com/DC=YourDomain,DC=com" enableSearchMethods="true" attributeMapUsername="sAMAccountName" connectionUsername="YourDomain\AdminUser" connectionPassword="Password"
    />
    </providers>
    </membership>
  7. Open IIS click  SharePoint Web Services then choose SecurityTokenServiceApplication, click explore in the right-pane, open the web.config for edit
  8. Add in the system.web section a connection string . For example name it adconn (don’t foreget to update the parts appear in green):
    <connectionStrings>
    <add name="adconn" connectionString="LDAP://YourDomain.com/DC=YourDomain,DC=com" />
    </connectionStrings>
  9. In the system.web section add/update the membership section (don’t foreget to update the parts appear in green): [Here is also a demo of the role provider you may add. If you are not using it, you may ignore the roleManager part]
    <membership>
    <providers>
    <add name="MyMembershipPro" applicationName="MyMembershipPro" type="YourCompiledProviderNameSpace.YourCompiledProviderClass, YourCompiledProviderDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YourCompiledProvideDllPublicToken"
    connectionStringName="adconn" enableSearchMethods="true" attributeMapUsername="sAMAccountName" connectionUsername="YourDomain\AdminUser" connectionPassword="Password"/>
    </providers>
    </membership>
    <roleManager enabled="true">
    <providers>
    <add name="MyRolePro" type="YourCompiledProviderNameSpace.YourCompiledProviderClass, YourCompiledProviderDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YourCompiledProvideDllPublicToken" applicationName="MyRolePro"/>
    </providers>
    </roleManager>
  10. Restart your IIS
  11. Now browse to the URL you selected in step 2. you should get this screen:sp5

Well done!

 

Server 2012 R2 and SharePoint 2013: The tool was unable to install Application Server Role, Web Server (IIS) Role.

  • If you coming across this error, you can try the following:
  1. Install the full IIS web server role.
  2. Make sure .NET 3.5 and features are fully installed
  3. Update the: “Specify settings for optional component installation and component repair”:
    1. Open a MMC console
    2. Add the Group Policy Object snap-in
    3. Following screen will open
    4. In Local Computer Policy go to Computer configuration –> Administrative Templates and select “System”.
    5. Scroll down the list in the System settings and find “Specify settings for optional component installation and component repair”. Double click the settings, a screen as displayed below will appear.
    6. Select enabled in the top left corner and select “Contact Windows Update directly to download repair content instead of Windows Server Update Services (WSUS)”.
    7. Click OK and close the MMC console.
  4. The installer is trying to run the executableC:\Windows\System32\ServerManagerCMD.exe

    “C:\Windows\system32\ServerManagerCmd.exe” -inputpath “somepath”

    Taking a look in the system32 directory, you’ll see that in R2,ServerManagerCMD.exe doesn’t exist!.  Take ServerManager.exe, copy it, and rename it to ServerManagerCMD.exe. Who cares if it’s messy, it works. Case in point:

  5. Another solution was to run: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regii -enable -i

One of the above should work 🙂