7 Types of Authorization in ASP.NET Core
Many .NET teams stop at "add [Authorize] and check roles." That covers two of seven authorization models ASP.NET Core ships with — and leaves you reaching for hacks when requirements get nuanced.
Authentication answers who the user is. Authorization answers what they can do. ASP.NET Core separates these cleanly: authentication middleware builds a ClaimsPrincipal; authorization runs afterward via policies, handlers, and filters. ASP.NET Core actually ships seven authorization types — simple, role-based, policy-based, claims-based, custom requirements, endpoint-specific, and resource-specific — each solving a different shape of what a user can do, with when to use each and minimal C# you can drop into a project.
For token validation at the API boundary, continue with the JWT security deep dive. For dependency boundaries around authorization code, see Clean Architecture in .NET.
Key takeaway
ASP.NET Core authorization is not one switch. Simple gates login. Roles gate coarse access. Policies name reusable rules. Claims carry permissions. Custom handlers encode domain logic. Endpoint metadata scopes routes. Resource checks enforce ownership.
Practice (25 min): create a Minimal API with dotnet new web -n AuthzLab, add /orders/{id} behind a CanEditOrder policy, and use a fake authenticated user with sub=user-1. Seed order 42 with owner user-1 and order 43 with owner user-2; run two integration requests. Pass only when 42 returns 200 and 43 returns 403 (or your documented 404 concealment policy), and neither denied request mutates the order. Then temporarily remove the resource check, prove the deny test fails, restore it, and rerun dotnet test to green.
Shoaib Hossain
Lead Author & Systems ArchitectSoftware engineer and distributed systems architect specializing in backend scalability, cloud-native infrastructure, databases, and AI engineering workflows. Author and maintainer of Core Concept Learning.
Related Articles
Explore this topic