PrimusSaaS.MultiTenancy.AspNetCore
1.1.0
dotnet add package PrimusSaaS.MultiTenancy.AspNetCore --version 1.1.0
NuGet\Install-Package PrimusSaaS.MultiTenancy.AspNetCore -Version 1.1.0
<PackageReference Include="PrimusSaaS.MultiTenancy.AspNetCore" Version="1.1.0" />
<PackageVersion Include="PrimusSaaS.MultiTenancy.AspNetCore" Version="1.1.0" />
<PackageReference Include="PrimusSaaS.MultiTenancy.AspNetCore" />
paket add PrimusSaaS.MultiTenancy.AspNetCore --version 1.1.0
#r "nuget: PrimusSaaS.MultiTenancy.AspNetCore, 1.1.0"
#:package PrimusSaaS.MultiTenancy.AspNetCore@1.1.0
#addin nuget:?package=PrimusSaaS.MultiTenancy.AspNetCore&version=1.1.0
#tool nuget:?package=PrimusSaaS.MultiTenancy.AspNetCore&version=1.1.0
PrimusSaaS.MultiTenancy.AspNetCore
Release status: stable integration package for PrimusSaaS.MultiTenancy.
ASP.NET Core integration package for Primus multi-tenancy.
Validation
- Current workspace validation: covered by the
PrimusSaaS.MultiTenancy.Testssuite, which passed242/242onnet8.0,net9.0, andnet10.0, plus smoke tests5/5 - Scope boundary: middleware and endpoint extensions only; tenant registry and provisioning remain outside the generic core
- For a first-time onboarding path that combines Identity Validator, Multi-Tenancy, and RBAC in one host, use
/docs/modules/combined-dotnet-integration
Usage
builder.Services
.AddPrimusMultiTenancy()
.AddPrimusMultiTenancyAspNetCore();
app.UseAuthentication();
app.UsePrimusTenantResolution();
app.UsePrimusTenantIsolation();
app.UsePrimusTenantRateLimiting();
app.UsePrimusTenantEntitlements();
app.UseAuthorization();
UsePrimusTenantIsolation() returns 401 for authenticated requests without resolved tenant context.
If TenantHeaderName is active in a production-style host, also register AddPrimusMultiTenancyMembershipValidatedSelection() with a real membership store path. Startup validation blocks unvalidated header-based tenant selection otherwise.
UsePrimusTenantEntitlements() enforces endpoint feature requirements against tenant tier metadata.
Feature-gated endpoints
builder.Services.Configure<MultiTenancyOptions>(o =>
{
o.PerTierEntitlements["Free"] = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"dashboard.view"
};
o.PerTierEntitlements["Pro"] = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"dashboard.view",
"reports.export"
};
o.DefaultTenantTier = "Free";
});
app.MapGet("/reports/export", ExportHandler)
.RequirePrimusFeature("reports.export");
If the current tenant tier is not entitled, the middleware returns 403 and records TenantEntitlementDenied through ITenantAuditSink.
Advanced hooks
AddPrimusMultiTenancyAspNetCore() registers defaults for:
ITenantRateLimiter→InMemoryTenantRateLimiterITenantBypassPolicy→DefaultTenantBypassPolicy
For multi-instance deployments, replace ITenantRateLimiter with a distributed implementation.
builder.Services.AddSingleton<ITenantRateLimiter, RedisTenantRateLimiter>();
To control support/super-admin access, override bypass policy:
builder.Services.AddSingleton<ITenantBypassPolicy, ApprovalBackedBypassPolicy>();
When bypass policy denies access, middleware returns 403 with Super-admin bypass denied.
Authenticated bootstrap flows without tenant context
If you compose this package with flows that create a user's first tenant membership, register ITenantRequirementExemptionPolicy to allow only those specific requests through before a tenant context exists.
Typical example:
POST /primus/invitations/{invitationId}/accept
Do not exempt broad path prefixes or all authenticated requests. Keep the policy narrow and auditable.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- PrimusSaaS.MultiTenancy (>= 1.1.0)
-
net8.0
- PrimusSaaS.MultiTenancy (>= 1.1.0)
-
net9.0
- PrimusSaaS.MultiTenancy (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.