Trellis.Authorization
3.0.0-alpha.98
dotnet add package Trellis.Authorization --version 3.0.0-alpha.98
NuGet\Install-Package Trellis.Authorization -Version 3.0.0-alpha.98
<PackageReference Include="Trellis.Authorization" Version="3.0.0-alpha.98" />
<PackageVersion Include="Trellis.Authorization" Version="3.0.0-alpha.98" />
<PackageReference Include="Trellis.Authorization" />
paket add Trellis.Authorization --version 3.0.0-alpha.98
#r "nuget: Trellis.Authorization, 3.0.0-alpha.98"
#:package Trellis.Authorization@3.0.0-alpha.98
#addin nuget:?package=Trellis.Authorization&version=3.0.0-alpha.98&prerelease
#tool nuget:?package=Trellis.Authorization&version=3.0.0-alpha.98&prerelease
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 | Versions 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. |
-
net10.0
- Trellis.Results (>= 3.0.0-alpha.98)
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 |