AsiBackbone.AspNetCore 3.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AsiBackbone.AspNetCore --version 3.1.0
                    
NuGet\Install-Package AsiBackbone.AspNetCore -Version 3.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="AsiBackbone.AspNetCore" Version="3.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsiBackbone.AspNetCore" Version="3.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AsiBackbone.AspNetCore" />
                    
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 AsiBackbone.AspNetCore --version 3.1.0
                    
#r "nuget: AsiBackbone.AspNetCore, 3.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 AsiBackbone.AspNetCore@3.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=AsiBackbone.AspNetCore&version=3.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AsiBackbone.AspNetCore&version=3.1.0
                    
Install as a Cake Tool

AsiBackbone.AspNetCore

ASP.NET Core host adapters for Accountable Systems Infrastructure governance primitives.

Stable 3.1.x package family. 3.1.0 is the current minor release for this package.

This package acts as a thin web-host adapter around AsiBackbone.Core.

New to AsiBackbone? Start with the concept, not this package: Intent to Execution: An Accountability Pattern and the documentation site. This README covers one package in the family.

Important: This package provides host adapters only. Low-level helpers do not enforce decisions automatically; endpoint-governance middleware acts only when the host explicitly adds it to the pipeline and registers the required host-owned policy, capability, audit, persistence, and transaction services. Attributes and route-builder calls do not by themselves make audit records durable, immutable, tamper-evident, or transactionally safe.

Service registration

Register the ASP.NET Core integration package from a plain ASP.NET Core host through IServiceCollection.

using AsiBackbone.AspNetCore.DependencyInjection;

builder.Services.AddAsiBackboneAspNetCore();

Host applications may configure the integration options explicitly.

builder.Services.AddAsiBackboneAspNetCore(options =>
{
    options.IncludeRouteValues = true;
    options.IncludeEndpointMetadata = true;
    options.IncludeRequestMethod = true;
    options.IncludeRequestPath = false;
    options.CorrelationIdHeaderNames = ["X-Correlation-ID", "X-Request-ID"];
});

The base registration is intentionally narrow. It does not register persistence, EF Core, authentication handlers, MVC, Razor Pages, Minimal API endpoints, policy evaluators, capability grant validators, or host-specific authorization behavior.

Ergonomic endpoint governance

UseAsiBackboneEndpointGovernance() evaluates AsiBackbone endpoint metadata before endpoint execution.

using AsiBackbone.AspNetCore.Endpoints;

app.UseAsiBackboneEndpointGovernance();

app.MapPost("/high-risk-action", handler)
    .RequireGovernancePolicy<MyStrictPolicy>()
    .RequireLiabilityHandshake()
    .RequireCapabilityGrant("robotics.execute")
    .EmitGovernanceAudit();

Controller/action attributes are also available:

[RequireGovernancePolicy(typeof(MyStrictPolicy))]
[RequireLiabilityHandshake]
[RequireCapabilityGrant("robotics.execute")]
[EmitGovernanceAudit]
public IActionResult ExecuteHighRiskAction()
{
    return Ok();
}

The metadata layer is optional and ergonomic. It does not replace full manual wire-up. Hosts that attach policy metadata should register an IAsiBackbonePolicyEvaluator<AsiBackboneConstraintEvaluationContext>. Hosts that attach capability metadata should register an IAsiBackboneEndpointCapabilityGrantValidator. Hosts that request audit emission should register a host-owned IAsiBackboneAuditSink.

Hosted governance outbox drain

AddAsiBackboneGovernanceOutboxDrainWorker registers a host-owned background worker that runs the provider-neutral Core AsiBackboneGovernanceOutboxDrain through dependency injection.

using AsiBackbone.AspNetCore.DependencyInjection;
using AsiBackbone.Core.Emissions;
using AsiBackbone.Core.Outbox;
using AsiBackbone.Storage.InMemory.Outbox;

builder.Services.AddSingleton<IAsiBackboneGovernanceOutboxStore, InMemoryGovernanceOutboxStore>();
builder.Services.AddSingleton<IAsiBackboneGovernanceEmitter>(NoOpGovernanceEmitter.Instance);

builder.Services.Configure<AsiBackboneGovernanceOutboxOptions>(options =>
{
    options.RetryDelay = TimeSpan.FromMinutes(2);
    options.DeferredDelay = TimeSpan.FromMinutes(5);
});

builder.Services.AddAsiBackboneGovernanceOutboxDrainWorker(options =>
{
    options.BatchSize = 25;
    options.PollingInterval = TimeSpan.FromSeconds(15);
});

AsiBackboneGovernanceOutboxOptions controls persisted retry timing when an emitter does not supply its own RetryAfterUtc. RetryDelay applies to unexpected emitter exceptions converted to retryable failures. DeferredDelay applies to pending/deferred emission results without a retry-after timestamp. Both default to one minute to preserve the original drain behavior.

The worker resolves the drain from a scoped service provider so host-owned durable stores can depend on scoped infrastructure such as EF Core DbContext instances. Production hosts should avoid duplicate active drain workers against the same durable outbox unless their store implements leasing, row claiming, partitioning, or provider-side idempotency.

Request correlation and audit enrichment

IAsiBackboneHttpRequestCorrelationResolver resolves request correlation data from the current HttpContext without making Core depend on ASP.NET Core types.

The default resolver:

  • checks configured correlation headers such as X-Correlation-ID and X-Request-ID;
  • trims and preserves valid printable client values up to AsiBackboneIdentifierLimits.MaximumLength characters;
  • ignores whitespace-only, oversized, or control-character-bearing values and continues to another configured value or the normal fallback;
  • falls back to HttpContext.TraceIdentifier when no acceptable configured header value is available;
  • captures a trace identifier from Activity.Current or the ASP.NET Core trace identifier;
  • emits safe request metadata such as method, route pattern, endpoint display name, and route values;
  • excludes sensitive request data such as headers, query strings, request bodies, cookies, and tokens by default.

Invalid correlation headers are not truncated or partially sanitized. The entire client value is discarded so two distinct hostile values cannot collapse into the same accepted identifier and control characters cannot reach logging, governance records, or bounded persistence columns. Server-generated fallback behavior is unchanged.

Example usage:

using AsiBackbone.AspNetCore.Correlation;
using AsiBackbone.Core.Audit;

AsiBackboneHttpRequestCorrelation correlation = correlationResolver.ResolveRequestCorrelation();

AuditResidue residue = correlation.CreateAuditResidue(
    actor,
    "ApproveWidget",
    decision);

Use AsiBackboneHttpRequestCorrelation.ToEvaluationContext(...) when a web host needs to carry the resolved correlation identifier and safe request metadata into a framework-neutral Core policy evaluation context.

HTTP result mapping

AsiBackboneHttpResultMappingExtensions maps Core GovernanceDecision and OperationResult instances into ASP.NET Core IResult responses through explicit helpers.

using AsiBackbone.AspNetCore.Results;
using AsiBackbone.Core.Decisions;

GovernanceDecision decision = GovernanceDecision.Deny(
    "policy.denied",
    "Internal policy detail for audit only.",
    correlationId: "request-123");

return decision.ToHttpResult();

Default governance decision mapping:

Core outcome Default HTTP behavior
Allowed 200 OK JSON response.
Warning 200 OK JSON response with retained reason codes.
Denied 403 Forbidden Problem Details response.
Deferred 202 Accepted Problem Details response.
AcknowledgmentRequired 428 Precondition Required Problem Details response.
EscalationRecommended 409 Conflict Problem Details response.

Default operation-result mapping:

Core result Default HTTP behavior
Success 200 OK JSON response.
Failure 400 Bad Request Problem Details response.

Reason codes and correlation identifiers are preserved by default when available. Reason messages, trace identifiers, policy versions, and policy hashes are not exposed by default because those values may reveal sensitive policy internals or diagnostic 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 (1)

Showing the top 1 NuGet packages that depend on AsiBackbone.AspNetCore:

Package Downloads
AsiBackbone.Testing

Test harness helpers for Accountable Systems Infrastructure endpoint governance, deterministic policy decisions, and in-memory inspection.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.1 109 8/7/2026
3.2.0 123 8/2/2026
3.1.0 133 7/20/2026
3.0.1 189 7/14/2026
3.0.0 160 7/13/2026 3.0.0 is deprecated.
2.3.0 469 7/6/2026
2.2.1 179 7/3/2026
2.2.0 141 7/1/2026
2.1.1 156 6/29/2026
2.1.0 127 6/28/2026
2.0.2 195 6/26/2026
2.0.1 128 6/26/2026
2.0.0 348 6/25/2026