dotnet-scaffold-resource-auth-handler

Scaffold an ASP.NET Core IAuthorizationHandler for row-level access control.

8|1|Updated Feb 5, 2018
One-click install
npx skills add https://github.com/umbrella-libraries/Umbrella --skill dotnet-scaffold-resource-auth-handler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-scaffold-resource-auth-handler
Source: https://github.com/umbrella-libraries/Umbrella/tree/main/.ai-shared/skills/dotnet-scaffold-resource-auth-handler
Command: npx skills add https://github.com/umbrella-libraries/Umbrella --skill dotnet-scaffold-resource-auth-handler

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Scaffold a resource-based ASP.NET Core IAuthorizationHandler to enforce row-level access control for a given entity, incorporating ownership checks (e.g., AppUserId) and operation-specific logic based on user roles.

Core Features & Use Cases

  • Provides an internal sealed class pattern that derives from AuthorizationHandler<OperationAuthorizationRequirement, TEntity> with a HandleRequirementAsync implementation.
  • Supports operation-specific logic for CoreItemOperations.Create, Read, Update, and Delete to enforce ownership or admin overrides.
  • Includes guidance to enable checks on the controller or controller service by removing suppression overrides and to register the handler in DI.

Quick Start

Remove the suppression override for the targeted authorization checks in your controller or service, and register the handler in DI.

Frequently Asked Questions about dotnet-scaffold-resource-auth-handler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scaffold an authorization handler for CRUD operations in dotnet?

An ASP.NET Core resource authorization handler requires an entity type for row-level data, a user identity for ownership comparison, and operation requirements. The handler derives from AuthorizationHandler<OperationAuthorizationRequirement, TEntity> to evaluate permissions against the specific resource instance.

What's the best way to enforce ownership checks in an ASP.NET Core controller service?

Enforce ownership checks by applying a resource-based IAuthorizationHandler with AppUserId ownership validation and role-based overrides. Remove the AuthorizationXxxChecksEnabled suppression override on the controller service and register the handler in dependency injection to activate row-level access control.

Does ASP.NET Core resource-based authorization support admin role overrides for CRUD operations?

ASP.NET Core resource-based authorization supports admin role overrides for Create, Read, Update, and Delete operations. The handler evaluates CoreItemOperations requirements, allowing administrative roles to bypass standard ownership restrictions while regular users are validated against the resource owner.

Why are my scaffolded resource authorization handlers not triggering in ASP.NET Core?

Resource authorization handlers fail to trigger when AuthorizationXxxChecksEnabled suppression overrides remain on the controller. Remove the suppression attributes and ensure the handler is registered in DI with AddScoped<IAuthorizationHandler, <Name>AuthorizationHandler>() for the pipeline to execute row-level checks.