Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Custom AuthorizeAttribute under Asp.net Core

$
0
0

I know current Authorize supports elements like below:

[Authorize(Roles = "XX", Policy = "XX")]
I want to add more elements enums like below:

[Authorize(Roles = "XX", Policy = "XX", Permission="Read")]
How to implement my own Authorize attribute and add new function for Permission? I have tried to inherit AuthorizeAttribute like below, but I do not know how to invoke Permission validate.

public class CustomAuthorizeAttribute : AuthorizeAttribute
{
    public string Groups { get; set; }
}

Any help would be appreciated


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>