Introduction
Custom Claims Provider issues and packages claims into security tokens which can be further used to give permission to the items in a customized way. Claims Augmentation enables an application to augment additional claims into the user token. Claims can be displayed in the people picker control through claims picking. In this article, I will explain how to create a Custom Claims Provider in SharePoint 2013 using the C# Server-Side Object Model.
Pre-Requisites
Open Visual Studio.
Open the New Project dialog box. Expand the Office/SharePoint node and then choose SharePoint Solutions.
![Visual Studio]()
Choose the SharePoint 2013 – Empty Project template. Name the project as ClaimProviderProject.
![Project template]()
Choose the Deploy as a farm solution option button and click Finish.
![Deploy]()
To create a Custom Claims Provider class file, right-click ClaimProviderProject project -> Add -> New Item.
![New Item]()
Add the class file and name it as CustomClaimsProvider.cs.
![Class file]()
Create Custom claims provider
Inherit SPClaimProvider to the new class created by adding Microsoft.SharePoint.Administration.Claims reference.
![Claims Provider]()
Add the fields for Claims Provider as Display Name, Internal Name, and People picker display name.
Add the properties for Display Name and Internal Name.
Override the SPClaimProvider properties, as shown below.
Create the constructor for the newly created class.
Override the SPClaimProvider methods as the following.
Override the FillClaimTypes method to add your custom claims type.
Override the FillClaimValueTypes method to add your custom value type.
Override the FillClaimsForEntity method to add your custom entities.
Override the FillEntityTypes method to add your custom entity type.
Override the FillResolve method to add your custom resolve claim.
Override the FillSchema method to add your custom schemas.
Override the FillSearch method to add your custom search claim.
Add the SharePoint Feature to this project and set it as Farm level.
![Farm level]()
Deploy this solution to the site.
Activate the custom Claims Provider using Windows PowerShell script.
- Set the IsEnabled to True for the Claim Provider.
- Add provider association to the Web Application.
Check if the custom Claims Provider is populated in the assigning permission to an item.
![Share]()
Summary
Thus, you have learned how to create a Custom Claims Provider in SharePoint 2013 using the C# Server-Side Object Model.