0

with the ClaimsAuthorizeAttribute (.net4.5) I can define required resources and actions like this:

[ClaimsAuthorize("View", "Administration")]

I can also add multiple attributes for more granular permissions

[ClaimsAuthorize("View", "Person")]
[ClaimsAuthorize("Edit", "Settings")]

but in the CheckAccess Method I have two seperated collections, which don't have any relation.

  public override bool CheckAccess(AuthorizationContext context)
        {

So I know there is "View" and "Edit" and on the other side is "Person" and "Settings"

But I don't know whether it was meant

"View Person" or "View Settings" nor

"Edit Person" or "Edit Settings"

How to deal with that?

Am I using the Resource and Action in a way that it was not meant to be?(.net 4.5)

Amirhossein Mehrvarzi
  • 11,037
  • 6
  • 38
  • 65
Boas Enkler
  • 11,465
  • 12
  • 61
  • 128

1 Answers1

4

ClaimsAuthorize is not part of .NET 4.5 - maybe you mean my version in IdentityModel ;)

When you have two attributes on e.g. a method - you will invoke ClaimsAuthorizationManager twice. Are you seeing something different?

Then there is a clear relationship between action and resource.

Amirhossein Mehrvarzi
  • 11,037
  • 6
  • 38
  • 65
leastprivilege
  • 17,248
  • 1
  • 29
  • 47
  • Yeah your right :) Its part of the identityModel. It integrates so perfectly that I thought it was part of .net :-) I didn't check wether the method is triggered twice. I'll do that this evening. Many thanks for your help! PS Is there somewhere a tutorial of all benefits of the IdentityModel out there? I use some classes (for example for creating principals) but I feel there is more then I use. – Boas Enkler Jan 21 '13 at 08:54