tags:

views:

35

answers:

1

I have implemented a WCF service that exposes operations that a Windows Forms client consumes. In the service, I am using claims-based authorization with a custom AuthorizationPolicy in which I insert my custom Claimset based on the principal identity before the operation code runs. The operations then require certain Claims within the Claimset in order to run.

So, given this, what is the best way to get the custom set of Claims on the client? I need this so that the client can do things like enable or disable buttons based on the authorization policy. Ideally, the client would need this information in advance of calling any of the operations (like on form load). So do I create a special operation that returns a Claimset object populated with the Claims that the client can use for UI decisions? Or is there some better built in pattern?

A: 

We do this as two calls to the server.

The first is: Does the user have the rights. In our case we send in a list of rights, and get a list back where each "right" is marked with a true or false.

The client uses this information to draw the UI.

When the actual call comes in, we recheck that the user has the right to make the call, in case someone has by passed the UI.

Shiraz Bhaiji
Thanks Shiraz. So the call to evaluate the claims is something you implement - there is a not a built in way to do it? I ended up doing something similar except that the service method I created returns that call's entire ClaimSet. That way, the client can cache the service's ClaimSet and can evaluate anything it wants locally at any time without having to make additional service calls.
MarkB
Yes, the call to evaluate the claims is something that we implement.
Shiraz Bhaiji