dotnet-scaffold-auth-policy

Define and register named authorization policies in shared project files.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Add a new named authorization policy to the shared project so that both server and Blazor client code can reference the same policy constants, enabling consistent access control and avoiding circular dependencies.

Core Features & Use Cases

  • Defines policy name constants in the shared Security.PolicyNames class and registers them via the shared AuthorizationOptions extension, ensuring centralized governance of access controls.
  • Allows applying policies across API controllers, Blazor components, and navigation items using standard RequireRole/RequireAssertion patterns.
  • Facilitates consistent policy scoping when features are added or reorganized, by keeping policy names and registration in a single shared location.

Quick Start

Add the policy constant in the shared policy names file and register it in the shared AuthorizationOptionsExtensions.

Frequently Asked Questions about dotnet-scaffold-auth-policy

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

FAQPage Schema
How do I share authorization policies between ASP.NET Core API controllers and Blazor components?

Scaffold cross-app authorization policies by defining policy name constants in a shared Security.PolicyNames class and registering them centrally via shared AuthorizationOptionsExtensions, ensuring consistent access control across ASP.NET Core API controllers and Blazor components.

What is the best way to avoid circular dependencies when adding named authorization policies in .NET?

Avoid circular dependencies by defining and registering named authorization policies in a single shared project location, allowing both server and Blazor client code to reference the same centralized policy constants without direct project-to-project dependencies.

Can I apply standard RequireRole and RequireAssertion patterns to Blazor navigation items?

Yes, you can apply standard RequireRole and RequireAssertion patterns to Blazor navigation items, API controllers, and Blazor components by referencing shared policy names to enforce specific access boundaries consistently across these application layers.

How do I register a new authorization policy in ASP.NET Core without duplicating code?

Register a new authorization policy without duplicating code by adding the policy constant to the shared Security.PolicyNames file and mapping it through the shared AuthorizationOptions extension, enabling predictable and centralized governance of access controls.

When do I need to centralize access control policy names in a shared .NET project?

Centralize access control policy names when features are added or reorganized and both server API controllers and Blazor client components require consistent policy scoping. Keeping policy names and registration in a single shared location prevents mismatched access boundaries.