Custom authorization attribute in .NET Core [duplicate]
问题 This question already has answers here : How do you create a custom AuthorizeAttribute in ASP.NET Core? (8 answers) Closed 2 years ago . I'm building an API in .NET Core 1.1. I build a custom User object from HttpContext.User in a base controller that all of my other controllers inherit from, and I have authentication enabled by default (must be manually disabled with [AllowAnonymous] when necessary). The User object has an IsAdmin property. Right now I'm checking if the user is an admin at