ASP.NET Core: Authorize and Secure Restful APIs
<p>I am trying to protect my APIs by providing a custom implementation for Authorize attribute.</p>

<p>Authorizing users based on resource and operation, which I specify for each action. In ASP.Net MVC, it was working like this:</p>

<pre><code>    [CustomAuthorize(Resource = "Values", Operation="List")
    public IEnumerable&lt;string&gt; Get()
    {
        return new string[] { "value1", "value2" };
    }
</code></pre>

<p>In CustomAuthorize class, I validate if the logged in user is granted the permission to access this resource by checking the permissions in his roles.</p>

<pre><code>public class CustomAuthorize : AuthorizeAttribute
{
    public string Resource { get; set; }
    public string Operation { get; set; }

    //validation here
}
</code></pre>

<p>I want to implement that in ASP.NET Core? Is that through Custom Policy-Based Authorization and how to pass the Operation and Resource Parameters?</p>