policies-based-authorization

Community

Policy-based authorization in ASP.NET Core.

AuthorAbdssamie
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Centralizes and standardizes authorization across ASP.NET Core apps by enabling policy-based access control with reusable requirements and handlers.

Core Features & Use Cases

  • Define reusable IAuthorizationRequirement and IAuthorizationHandler components.
  • Register policies via services.AddAuthorization and enforce them with [Authorize(Policy = "...")] or RequireAuthorization.
  • Create single or multiple handlers for OR/AND evaluation and easily test authorization logic.
  • Use the Resource/HttpContext in handlers to tailor policy evaluation to the current request.

Quick Start

Enable policy-based authorization in a new ASP.NET Core app by configuring services:

  • In Program.cs or Startup.cs, add services.AddAuthorization(...);
  • Create a MinimumAgeRequirement and a MinimumAgeHandler, register them in DI, and apply a policy with [Authorize(Policy = "AtLeast21")];
  • Build and run, then test with a user that satisfies the policy.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: policies-based-authorization
Download link: https://github.com/Abdssamie/Quater/archive/main.zip#policies-based-authorization

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.