Pragmatic.Authorization.Management.EFCore 1.0.0-alpha.6

This is a prerelease version of Pragmatic.Authorization.Management.EFCore.
dotnet add package Pragmatic.Authorization.Management.EFCore --version 1.0.0-alpha.6
                    
NuGet\Install-Package Pragmatic.Authorization.Management.EFCore -Version 1.0.0-alpha.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pragmatic.Authorization.Management.EFCore" Version="1.0.0-alpha.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pragmatic.Authorization.Management.EFCore" Version="1.0.0-alpha.6" />
                    
Directory.Packages.props
<PackageReference Include="Pragmatic.Authorization.Management.EFCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pragmatic.Authorization.Management.EFCore --version 1.0.0-alpha.6
                    
#r "nuget: Pragmatic.Authorization.Management.EFCore, 1.0.0-alpha.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pragmatic.Authorization.Management.EFCore@1.0.0-alpha.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pragmatic.Authorization.Management.EFCore&version=1.0.0-alpha.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pragmatic.Authorization.Management.EFCore&version=1.0.0-alpha.6&prerelease
                    
Install as a Cake Tool

Pragmatic.Authorization

The authorization engine for Pragmatic.Design: permissions, roles, groups, wildcard matching, resource (instance-level) policies, and a permission cache, declarative and observable.

The Problem

Authorization in most .NET apps starts simple and rots. Permission strings are hardcoded and scattered across controllers; role-to-permission mapping lives in if-statements; wildcard handling is hand-rolled and inconsistent; instance-level checks ("can this user act on this invoice?") are buried in business logic. Ask "what can the booking-manager role do?" and the answer means reading every controller.

// Typical: scattered, fragile, invisible
var permissions = User.Claims.Where(c => c.Type == "permission").Select(c => c.Value).ToHashSet();
if (!permissions.Contains("booking.reservation.cancel")
    && !permissions.Any(p => p == "booking.reservation.*")
    && !permissions.Contains("*"))
    return Forbid();

The Solution

Declare what is protected and how; the framework handles resolution, wildcard matching, caching, and enforcement.

[DomainAction]
[RequirePermission(BookingPermissions.Reservation.Cancel)]
[RequirePolicy<ReservationCancellationPolicy>]
public sealed partial class CancelReservationAction : VoidDomainAction
{
    // business logic only: no authorization code here
}
// Roles compose from module definitions, declared once in Program.cs
app.UseAuthorization(authz =>
{
    authz.MapRole<BookingManagerRole>(r => r
        .IncludeDefinition<BookingOperator>()
        .IncludeDefinition<CatalogReader>());
    authz.AddResourceAuthorizer<InvoiceAuthorizer>();   // instance-level (ABAC)
    authz.UsePermissionCache(TimeSpan.FromMinutes(5));
});

What it covers

  • Permissions: wildcard-aware matching (booking.*, *), one generated {Boundary}Permissions class of consts: the entities' CRUD and the custom ones declared with [assembly: Permission].
  • Roles & groups: compose roles from reusable definitions; map groups to roles.
  • Resource policies (ResourcePolicy): instance-level "can this user act on this object?" checks.
  • Stores & caching: pluggable role/permission/group stores; cross-request HybridCache.
  • Pipeline enforcement: [RequirePermission] / [RequirePolicy] enforced in the Actions/Endpoints pipeline.

Installation

dotnet add package Pragmatic.Authorization
dotnet add package Pragmatic.SourceGenerator   # generates permission constants/registry

Status

Functional within 1.0.0-alpha: roles, groups, wildcard permissions, resource authorizers, and the permission cache. See the roadmap.

Documentation

Guide What you'll learn
Concepts Mental model, permission strings, the resolution chain, where authorization runs
Getting Started Protect an action, define permissions, map a role
Permission Resolution The full resolution chain, wildcard matching, caching
Roles & Groups IRole/IRoleDefinition, composition, groups
Policies ResourcePolicy, [RequirePolicy<T>], instance-level (ABAC) checks
Stores Role/permission/group stores, customization, temporal/tenant variants
Common Mistakes The most frequent authorization pitfalls
Troubleshooting Problem/solution guide with diagnostics

Cross-module integration

Enforced by Actions and Endpoints; identity comes from Identity; data-level filters live in Persistence. Interfaces live in Pragmatic.Abstractions.

Requirements

  • .NET 10.0+
  • Pragmatic.SourceGenerator analyzer

License

Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Authorization is licensed under the PolyForm Small Business 1.0.0 license (free for small businesses; commercial license above the threshold).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.6 91 11/21/2026
1.0.0-alpha.5 53 11/21/2026
1.0.0-alpha.4 66 11/16/2026