Skip to content
Tracon

TraconTenancyOptions

Namespace Tracon · Assembly Tracon.AspNetCore.dll

Settings that determine how the tenant is resolved from the request.

public sealed class TraconTenancyOptions
Inheritance
object ← TraconTenancyOptions
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Off by default. A single-tenant setup needs no extra configuration, and every request falls to the TraconOptions.DefaultTenantId tenant.

A header can be spoofed. An HTTP header is not proof of identity; the client can write any value it wants. Therefore:

This type is deliberately not a record; settings classes’ generated ToString method could leak values.

public TraconTenancyOptions()

Whether the tenant can be resolved from the header. Off by default — a header can be spoofed.

public bool AllowHeaderResolution { get; set; }

bool

The accepted tenant ids. If left empty, any value matching the format is accepted.

public IList<string> AllowedTenants { get; }

IList<string>

The format is ^[a-zA-Z0-9_.-]+$, at most 64 characters. A value that does not match is never resolved.

Letter case does not distinguish two tenants. Entries and incoming values are both folded with AmbientTenantScope.Normalize before they are compared, so Acme here admits a request that arrives as acme, and the reverse. The same fold is what every store persists, so one tenant can never split into two rows because someone typed a capital letter.

The claim type the tenant is read from. Example: tenant_id. If set and the request passed authentication, it takes precedence over the header.

public string? ClaimType { get; set; }

string?

Whether multi-tenancy is enabled. When disabled, every request falls to the default tenant.

public bool Enabled { get; set; }

bool

The HTTP header the tenant is read from.

public string HeaderName { get; set; }

string