9

Can anybody explain how to setup my custom claims both for REQUEST and SESSION scope using the Ambient Data Framework API. I need a claim that once it is set it stays set until the session is gone. (I need this for a .NET application).

I tried to setup a few claims in Ambient Data Framework from my .net application in the same way I used to do in 2011, but this application uses the 2013 Content Delivery API. I used the following code:

AmbientDataContext.CurrentClaimStore.Put(
          new Uri("taf:claim:jaimesideas:blogurl"), 
          "http://jaimesantosalcon.blogspot.com");

However after doing it the claim will only be "alive" for the duration of the Request I set the claim in. So I checked the documentation and couldn't find anything explaining how to set up your own claims other than by creating your own cartridge. Do I need a cartridge always I have to setup claims? If so, What method should I overwrite from the AbstractClaimProcessor class? How does that cartridge and config file look like?

Thank you!

Here is my configuration file:

jsa_cartidge.xml

  • get blog promo there hayme ! – johnwinter Oct 2 '13 at 9:39
5

Unfortunately, you cannot set a claim's scope to SESSION through code. The only way to define that a claim's scope is SESSION and not REQUEST is via the claim definition configuration xml.

We have fixed this for the next service pack release (2013 SP1).

I have not tried it, but you might be able to define a claim through a simple ADF cartridge (using the xml configuration to set the scope of the claim to SESSION) and then update the claim's value through code as needed?

Something along these lines:

<ClaimDefinition Uri="taf:claim:jaimesideas:blogurl" 
                 Scope="SESSION" Description="Something" />
  • I already did that and my claim goes away once the request ends. That's what confuses me. I know the .Put method does not have a parameter for the scope. So I implemented my cartridge, but I am not sure which methods to implement... – Jaime Santos Alcón Oct 1 '13 at 13:04
  • 1
    You're probably in need of some rubber-ducking then (en.wikipedia.org/wiki/Rubber_duck_debugging). This works for sure, as Tridion itself can set claims with SESSION scope using the same API. Could you be defining it twice somehow? Maybe you need to get the claim first, then set its value? – Nuno Linhares Oct 1 '13 at 13:10
  • I am not saying it doesn't work, simply that I don't know what to do to make it work. Do I need to implement the onRequestStart and onRequestEnd methods? Maybe the onSessionStart? Should I define Input/Output claims? – Jaime Santos Alcón Oct 1 '13 at 13:26
  • Nuno, you were right. It works, I had an issue with the "Session" configuration in my web.config. Basically My pages were not session aware, so setting the claims failed. – Jaime Santos Alcón Oct 1 '13 at 15:24
2

I wrote a post with an example on how to add your custom claims to ADF within your Application

Managing claims and their scope in SDL Tridion's Ambient Data Framework 2013

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.