Porting ClaimsAuthorizationManager to .NET Core

519 views Asked by At

I am preparing to port an .NET 4.6.1 application to .NET Core and struggle to find how the code permissions should be handled. Currently i use custom ClaimsAuthorizationManager

public class AuthorizationManager : 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);
    }
}

The ClaimsAuthorizationManager is configured to be used by application in app.config file.

Then each function that needs to have a code access permission has an ClaimsPrincipalPermission set with required permissions. Now i would want to achieve same functionality in .NET Core and outside of MVC. Anyone has any idea if and how is this achievable? Thanks.

0

There are 0 answers