Tuesday, July 10, 2012

Creating and Deploying a Custom Claims Provider End-to-End

  1. Create an Empty SharePoint Project 
    1. Enter the Url to your SharePoint Farm
    2. Select Deploy as a farm solution
  2. Add a Feature to the project
  3. Provide Feature details such as Name/Title and description etc.
  4. Set the Feature Scope to Farm
  5. Add a reference to the Microsoft.IdentityModel assembly that is part of Windows Identity Foundation.
  6. Create a primary class that inherits from SPClaimProvider
  7. If there are any supplemental classes that are required to support your Custom Claims Provider, you can add/create those as well.
  8. Begin populating the content in the classes with the necessary content to support the various features you require such as Claims Hierarchy, Search & Resolve, Claims Augmentation etc.
  9. Add a Claims Receiver class that inherits from SPClaimProviderFeatureReceiver
  10. You may now have to manually edit your Feature to include the ReceiverClass and ReceiverAssembly attributes.  (This may require disabling the designer in order to edit the manifest directly in the XML editor)
  11. If you do not know the assembly details to populate in the ReceiverAssembly attribute, you can use a tool such as Jetbrains dotPeek or Telerik JustDecompile to view the assembly attributes including the PublicKeyToken.
  12. From within the SharePoint project, right click on the Features node and select "Copy to SharePoint Root"
  13. If the feature folder has been deployed successfully, you should be able to find the folder beneath the 14 Hive under "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES"
  14. Now, right click on the SharePoint project file in Visual Studio and select Deploy.
  15. If the deployment succeeded, you should now be able to view your Custom Claims Provider when you select the People Picker in SharePoint!

No comments:

Post a Comment