Trellis.Authorization 3.0.0-alpha.524

This is a prerelease version of Trellis.Authorization.
dotnet add package Trellis.Authorization --version 3.0.0-alpha.524
                    
NuGet\Install-Package Trellis.Authorization -Version 3.0.0-alpha.524
                    
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="Trellis.Authorization" Version="3.0.0-alpha.524" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.Authorization" Version="3.0.0-alpha.524" />
                    
Directory.Packages.props
<PackageReference Include="Trellis.Authorization" />
                    
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 Trellis.Authorization --version 3.0.0-alpha.524
                    
#r "nuget: Trellis.Authorization, 3.0.0-alpha.524"
                    
#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 Trellis.Authorization@3.0.0-alpha.524
                    
#: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=Trellis.Authorization&version=3.0.0-alpha.524&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.Authorization&version=3.0.0-alpha.524&prerelease
                    
Install as a Cake Tool

Trellis.Authorization

NuGet Package

Lightweight authorization primitives for permissions, actors, and resource-based checks.

Installation

dotnet add package Trellis.Authorization

Quick Example

using System.Collections.Generic;
using Trellis;
using Trellis.Authorization;

var actor = Actor.Create("user-1", new HashSet<string> { "orders:read" });

IResult result = actor.HasPermission("orders:read")
    ? Result.Ok()
    : Result.Fail(new Error.Forbidden("policy.id") { Detail = "Missing permission." });

Key Features

  • AddSharedResourceAuthorization<TMessage,TResource,TId,TResponse>() from Trellis.Mediator registers the typed behavior, accessor, and shared-loader bridge together; register your SharedResourceLoaderById<TResource,TId> implementation separately. The lower-level AddResourceAuthorization<TMessage,TResource,TResponse>() still leaves all loader registration to the caller.
  • ActorId opts into [Trim, NotDefault]; trimming and blank rejection are not the unannotated RequiredString<T> defaults.
  • Defines Actor, ActorId, IActorProvider, IAuthorize, and resource authorization interfaces.
  • actorProvider.RequireActorAsync(ct) requires established actor presence and stable or explicitly cached provider resolution. It performs another lookup, not retrieval of the actor previously checked by authorization, and throws InvalidOperationException when absent. Use the same scoped caching provider for authorization and the handler when identity or permissions can change. Ordinary unauthenticated flows still use GetCurrentActorAsync and handle absence.
  • Actor.Id is the strongly-typed ActorId value object — reuse it on consumer aggregate boundaries (Order.CreatedByActorId, Document.LastModifiedByActorId) for type-checked principal-identity comparisons.
  • Works without ASP.NET Core, Mediator, or any web dependency.
  • Keeps permission rules inside the same Result-based workflow as the rest of your application.

Documentation

Part of Trellis

This package is part of the Trellis framework.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on Trellis.Authorization:

Package Downloads
Trellis.Asp

ASP.NET Core integration for Trellis. Result-to-HTTP response mapping, rate-limit rejection handling, scalar value validation, JSON converters (with bundled AOT source generator), and ASP.NET actor providers (Claims, Entra, Easy Auth, Development) for Trellis.Authorization.

Trellis.Mediator

Result-aware pipeline behaviors for martinothamar/Mediator. Provides validation, authorization, logging, tracing, and exception handling behaviors that understand Trellis Result types and short-circuit correctly.

Trellis.Testing

FluentAssertions extensions and test doubles for Trellis - assert Result, Maybe, and Error types with readable fluent syntax

Trellis.EntityFrameworkCore

EF Core integration for Trellis. Convention-based value converter registration for Trellis primitives, Result-returning SaveChanges wrappers, Maybe/Result query extensions, and provider-agnostic database exception classification.

Trellis.Testing.AspNetCore

ASP.NET Core integration test utilities for Trellis - WebApplicationFactory helpers, DI service replacement, fake time providers, and MSAL token acquisition

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-alpha.524 65 9/27/2026
3.0.0-alpha.520 102 9/25/2026
3.0.0-alpha.516 209 9/22/2026
3.0.0-alpha.513 107 9/22/2026
3.0.0-alpha.505 232 9/13/2026
3.0.0-alpha.495 317 8/24/2026
3.0.0-alpha.458 316 8/19/2026
3.0.0-alpha.455 213 8/19/2026
3.0.0-alpha.449 162 8/18/2026
3.0.0-alpha.447 161 8/18/2026
3.0.0-alpha.432 205 7/6/2026
3.0.0-alpha.428 174 7/3/2026
3.0.0-alpha.425 213 6/27/2026
3.0.0-alpha.419 128 6/24/2026
3.0.0-alpha.418 299 6/23/2026
3.0.0-alpha.417 122 6/23/2026
3.0.0-alpha.397 217 6/18/2026
3.0.0-alpha.396 119 6/18/2026
3.0.0-alpha.394 135 6/18/2026
3.0.0-alpha.385 141 6/15/2026
Loading failed