0

I have the following method:

[ClaimsPrincipalPermission(SecurityAction.Demand, Resource = "Order", Operation = "Place")]
public string PlaceNewOrder() { }

When the AuthorizationContext.Principal does not have the required Claims, a SecurityException is thrown (as expected). Unfortunately, all the properties of this exception (such as Action or Demanded) are null.

Is there a way to get to the attribute information from the exception? It would be nice if you can show the user which specific claim caused the failure.

2
Contributors
2
Replies
20
Views
2 Years
Discussion Span
Last Post by pritaeas
0

No. InnerException is also null.

Here's what I get:

System.Security.SecurityException occurred
  HResult=-2146233078
  Message=ID4266: De aanvraag voor ClaimsPrincipalPermission is mislukt voor: 
  Actie: 'System.Collections.ObjectModel.Collection`1[System.Security.Claims.Claim]', 
  Resource: 'System.Collections.ObjectModel.Collection`1[System.Security.Claims.Claim]'.
  Source=System.IdentityModel.Services
  StackTrace:
       bij System.IdentityModel.Services.ClaimsPrincipalPermission.Demand()
  InnerException: 

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.