Thursday, March 3, 2011

How to set up a Custom Attribute Store in ADFS 2.0

The custom attribute store provides the possibility to get claims from different sources like different databases, text files. In order to set up a custom attribute store is required to create an assembly that contains the classes with the methods that implements its functionality. The reference for this task is provided by MSDN .In order to set up the custom attribute store you have to take into account the following points:
.NET Framework 3.5
Make sure that you use the .NET Framework 3.5, the WIF references points to the 3.5 and the engine of ADFS does not support .NET Framework 4.0 yet. So if you use an earlier version you will get an error in the Event Viewer:
Error 149: Could not load file or assembly 'CustomAttributeStore' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Register the assembly in the GAC (Global Assembly Cache)
Make sure that the assembly has a strong name, if you don’t do it, you will get an error in the command prompt that makes reference to this issue.
You can perform this task in visual studio going to Project Name > Properties >Signing > [Checkbox] Sign the assembly. Then choose a name for the key
Register the attribute store in the ADFS 2.0 Management Console
Open the ADFS 2.0 Management Console, and in the left pane open the folder of Trust Relationships and the select the folder of Attribute Stores.

(As shown in the first image)
Then, select in the right pane the option Add Custom Attribute Store. (As shown in the second image)
Then, it will prompt a window that requests the information of the store. Provide the full name, it means:
CustomAttributeStores.AttributeStore,AttributeStore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=.
Check that the attribute store is workingCheck in the event viewer for a 149 event id. If you don’t find it, it means that the attribute is ready.

2 comments:

  1. Hi, thanks for the article, in this i could see the images were removed, so please help me to provide exact images and steps. in my case my developer provided the custom attribute dll file and i copied it an programfiles/ADFS folder. however i am bit confused in registering the custom attribute and public key. could you please help me to complete this

    ReplyDelete