ApricotFramework.AccessAuthorization.ErrorDefinitions 0.1.0

Prefix Reserved
dotnet add package ApricotFramework.AccessAuthorization.ErrorDefinitions --version 0.1.0
                    
NuGet\Install-Package ApricotFramework.AccessAuthorization.ErrorDefinitions -Version 0.1.0
                    
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="ApricotFramework.AccessAuthorization.ErrorDefinitions" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApricotFramework.AccessAuthorization.ErrorDefinitions" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ApricotFramework.AccessAuthorization.ErrorDefinitions" />
                    
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 ApricotFramework.AccessAuthorization.ErrorDefinitions --version 0.1.0
                    
#r "nuget: ApricotFramework.AccessAuthorization.ErrorDefinitions, 0.1.0"
                    
#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 ApricotFramework.AccessAuthorization.ErrorDefinitions@0.1.0
                    
#: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=ApricotFramework.AccessAuthorization.ErrorDefinitions&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ApricotFramework.AccessAuthorization.ErrorDefinitions&version=0.1.0
                    
Install as a Cake Tool

ApricotFramework.AccessAuthorization

NuGet NuGet NuGet CI License

Authorization for .NET built on an ordered rule pipeline: deny by default, with statically assigned accesses as one rule among several. One call answers both is this allowed and what is allowed, so a user interface and a gate can never disagree.

ApricotFramework.AccessAuthorization is the zero-dependency core.

Install

dotnet add package ApricotFramework.AccessAuthorization
dotnet add package ApricotFramework.AccessAuthorization.AspNetCore

Usage

using ApricotFramework.AccessAuthorization.AspNetCore.Extensions;

builder.Services.AddAccessAuthorization(builder.Configuration);
builder.Services.AddAccessStore<MyAccessStore>();        // where assigned accesses come from
builder.Services.AddAccessCatalog(ContentAccesses.All);  // needed only to list capabilities
builder.Services.AddAccessBypassRule<RootBypassRule>();  // runs before the assigned lookup
builder.Services.AddAccessRule<OwnerCanEditRule>();      // runs after it

The attributes work unchanged on a controller action, a minimal-API endpoint and a gRPC method, because they carry their requirement as endpoint metadata rather than running as an MVC filter:

[AuthorizeAnyAccess(ContentAccesses.OrdersRead)]
public object Get(string id) => this.repository.Find(id);

[AuthorizeAllScopes("sales.read")]                        // on a gRPC method
public override Task<GetOrderReply> GetOrder(GetOrderRequest request, ServerCallContext context) => …

And the listing a user interface renders from, which runs the same pipeline as the gates:

var allowed = await httpContext.GetAllowedAccessesAsync(AccessResource.Create("sales:order", id));

Subject attributes are strings, since they come from claims and key the cache; resource and environment attributes keep their domain types, so a rule matches rather than parses (if (resource.Attributes["isPublic"] is true)).

Note that an assigned access ignores the resource: a granted sales:orders:edit means the subject may edit orders, not one particular order. Narrowing a grant to an instance is a rule of your own, registered after the assigned lookup — see the docs for why that division is deliberate.

Denials carry an RFC 9457 problem-details body — from an attribute as well as from an imperative check — if you add ApricotFramework.AccessAuthorization.ErrorDefinitions.

Full documentation: https://projectapricot.dev/docs/access-authorization

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

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
0.1.0 118 8/31/2026