我有一个基类和派生类,例如
[ClaimsPrincipalPermission(SecurityAction.Demand, Resource = "Base",
Operation = "Create")]
public abstract class Base
{
}
[ClaimsPrincipalPermission(SecurityAction.Demand, Resource = "Derived",
Operation = "Create")]
public class Derived : Base
{
}
如果我正在创建派生类对象,授权管理器永远不会检查基类。
public class AuthorisationManager : ClaimsAuthorizationManager
{
public override bool CheckAccess(AuthorizationContext context)
{
var resource = context.Resource.First().Value;
var action = context.Action.First().Value;
return context.Principal.HasClaim(resource, action);
}
}
知道如何实现它应该同时检查派生类和基类吗?实际上我希望如果其中任何一个有权限,则应该允许创建对象。