Trellis.Authorization 3.0.0-alpha.98

This is a prerelease version of Trellis.Authorization.
dotnet add package Trellis.Authorization --version 3.0.0-alpha.98
                    
NuGet\Install-Package Trellis.Authorization -Version 3.0.0-alpha.98
                    
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.98" />
                    
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.98" />
                    
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.98
                    
#r "nuget: Trellis.Authorization, 3.0.0-alpha.98"
                    
#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.98
                    
#: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.98&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.Authorization&version=3.0.0-alpha.98&prerelease
                    
Install as a Cake Tool

Trellis.Authorization

Lightweight authorization primitives for Trellis.

Provides Actor, IActorProvider, IAuthorize, and IAuthorizeResource<TResource> types that integrate with the Trellis Result<T> type system. No dependency on any mediator or web framework.

Types

Type Purpose
Actor Represents the current user with Id and Permissions
IActorProvider Abstraction for resolving the current actor (implement in API layer)
IAuthorize Marker for static permission-based authorization
IAuthorizeResource<TResource> Resource-based authorization with a loaded resource (ownership checks)
IResourceLoader<TMessage, TResource> Loads the resource required for IAuthorizeResource<TResource>
ResourceLoaderById<TMessage, TResource, TId> Convenience base class for ID-based resource loading

Usage

using Trellis.Authorization;

// Implement IActorProvider in your API layer
public class HttpActorProvider(IHttpContextAccessor accessor) : IActorProvider
{
    public Actor GetCurrentActor()
    {
        var user = accessor.HttpContext!.User;
        var id = user.FindFirstValue(ClaimTypes.NameIdentifier)!;
        var permissions = user.Claims
            .Where(c => c.Type == "permission")
            .Select(c => c.Value)
            .ToHashSet();
        return Actor.Create(id, permissions);
    }
}

See the full documentation for details.

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 (2)

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

Package Downloads
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.Asp.Authorization

Azure Entra ID v2.0 actor provider for Trellis. Maps JWT claims to Actor with permissions, forbidden permissions, and ABAC attributes. Integrates Trellis.Authorization with ASP.NET Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-alpha.98 0 3/3/2026
3.0.0-alpha.95 28 3/2/2026
3.0.0-alpha.94 28 3/2/2026
3.0.0-alpha.93 35 3/1/2026
3.0.0-alpha.92 39 2/28/2026