Cirreum.Runtime.AuthorizationProvider 1.0.20

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

Cirreum.Runtime.AuthorizationProvider

NuGet Version NuGet Downloads GitHub Release License .NET

Base registration infrastructure for Cirreum authorization providers

Overview

Cirreum.Runtime.AuthorizationProvider provides the runtime layer for registering authorization providers with ASP.NET Core applications. It includes the provider registration pattern, role enrichment via claims transformation, and diagnostics. This package is typically not referenced directly.

Note: For the complete authorization system with all provider implementations (Entra ID, API Key, Signed Request, External/BYOID), see Cirreum.Runtime.Authorization. Most applications should reference that package instead of this one directly.

Features

  • Type-safe provider registration with generic constraints
  • Configuration-driven setup using hierarchical configuration sections
  • Multiple provider instances support per registrar type
  • Role enrichment via IRoleResolver — resolves application roles from your data store and adds them as ClaimTypes.Role claims
  • DiagnosticsActivitySource, Meter, and per-request ClaimsTransformResult stashed in HttpContext.Items for debugging
  • Duplicate registration protection with automatic detection
  • Structured logging with deferred execution for performance
  • Seamless ASP.NET Core integration through IHostApplicationBuilder extensions

Installation

dotnet add package Cirreum.Runtime.AuthorizationProvider

Usage

Provider Registration

Authorization providers are registered during application startup. Each provider type has its own registrar that reads from the hierarchical configuration:

var builder = DomainApplication.CreateBuilder(args);
var authBuilder = builder.Services.AddAuthentication();

// Register an authorization provider (typically called by the Runtime)
builder.RegisterAuthorizationProvider<EntraAuthorizationRegistrar, EntraAuthorizationSettings, EntraAuthorizationInstanceSettings>(authBuilder);

Configuration Structure

Configure your authorization providers in appsettings.json. Instances are keyed by name:

{
  "Cirreum": {
    "Authorization": {
      "Providers": {
        "Entra": {
          "Instances": {
            "Primary": {
              "Enabled": true,
              "Audience": "api://my-app",
              "TenantId": "your-tenant-id",
              "ClientId": "your-client-id"
            }
          }
        }
      }
    }
  }
}

Role Enrichment

For audience-based providers (Entra, Okta, OIDC), you can resolve application roles from your data store and add them as claims. Register your IRoleResolver implementation via CirreumAuthorizationBuilder:

builder.AddAuthorization(auth => auth
    .AddRoleResolver<MyRoleResolver>()
);

The resolver is called once per request during claims transformation. Requests that already carry role claims (e.g., workforce tokens) are skipped automatically.

public class MyRoleResolver : IRoleResolver {
    public async Task<IReadOnlyList<string>?> ResolveRolesAsync(
        string externalUserId,
        CancellationToken cancellationToken = default) {
        // Load roles from your database
        return await db.GetRolesForUserAsync(externalUserId, cancellationToken);
    }
}

Diagnostics

The claims transformer stashes a ClaimsTransformResult in HttpContext.Items after every transformation pass. Useful for debugging authorization issues in middleware or diagnostic endpoints:

if (httpContext.Items[ClaimsTransformResult.ItemsKey] is ClaimsTransformResult result) {
    // result.Outcome:       "RolesResolved", "AlreadyTransformed", "NoUserIdentifier", etc.
    // result.ResolverType:  "MyRoleResolver"
    // result.UserId:        The external user ID from the token
    // result.RoleClaimType: The claim type used for roles
    // result.RoleCount:     Number of roles added
}

Telemetry is produced via System.Diagnostics using the diagnostic name Cirreum.AuthorizationProvider. The OTel subscription is handled automatically by CirreumAuthorizationBuilder.AddRoleResolver<T>().

Contribution Guidelines

  1. Be conservative with new abstractions
    The API surface must remain stable and meaningful.

  2. Limit dependency expansion
    Only add foundational, version-stable dependencies.

  3. Favor additive, non-breaking changes
    Breaking changes ripple through the entire ecosystem.

  4. Include thorough unit tests
    All primitives and patterns should be independently testable.

  5. Document architectural decisions
    Context and reasoning should be clear for future maintainers.

  6. Follow .NET conventions
    Use established patterns from Microsoft.Extensions.* libraries.

Versioning

Cirreum.Runtime.AuthorizationProvider follows Semantic Versioning:

  • Major - Breaking API changes
  • Minor - New features, backward compatible
  • Patch - Bug fixes, backward compatible

Given its foundational role, major version bumps are rare and carefully considered.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Cirreum Foundation Framework
Layered simplicity for modern .NET

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 Cirreum.Runtime.AuthorizationProvider:

Package Downloads
Cirreum.Runtime.Authorization

The Runtime Authorization configuration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.20 123 5/7/2026
1.0.19 110 5/1/2026
1.0.18 110 4/28/2026
1.0.17 126 4/26/2026
1.0.16 129 4/15/2026
1.0.15 192 3/17/2026
1.0.14 155 3/13/2026
1.0.12 135 3/10/2026
1.0.11 118 3/9/2026
1.0.10 106 3/6/2026
1.0.9 189 1/21/2026
1.0.8 273 12/20/2025
1.0.7 143 12/20/2025
1.0.6 199 12/20/2025
1.0.5 249 12/19/2025
1.0.4 287 12/19/2025
1.0.3 310 12/16/2025
1.0.2 206 11/29/2025
1.0.1 243 11/24/2025
1.0.0 315 11/21/2025