Skip to content

StoreTenantCatalog Class

The tenants a store of tenants holds, as last read: the checks of the tenant list judge each reading, each tenant they pass is readied to be served, and the tenants refused or not readied are left out and logged while the rest are served.

C#
public sealed class StoreTenantCatalog : Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog

Inheritance System.Object → StoreTenantCatalog

Implements ITenantCatalog

Remarks

Asked on every request, static files included, so it answers from the last reading and never from the store. A tenant whose id, generation and version are unchanged keeps the definition read before, so what was built from it is not built again. What was built for a tenant from its definition in force (Abblix.Oidc.Server.Features.MultiTenancy.StoreTenantCatalog.InForce(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition)) is not replaced from another definition, so a request still holding one this catalog replaced is answered with what was built.

Constructors

StoreTenantCatalog(ILogger<StoreTenantCatalog>, ITenantStore, IEnumerable<ITenantsCheck>, IEnumerable<ITenantOpening>, IEnumerable<ITenantClosing>, IOptions<OidcOptions>, TimeProvider) Constructor

The tenants a store of tenants holds, as last read: the checks of the tenant list judge each reading, each tenant they pass is readied to be served, and the tenants refused or not readied are left out and logged while the rest are served.

C#
public StoreTenantCatalog(Microsoft.Extensions.Logging.ILogger<Abblix.Oidc.Server.Features.MultiTenancy.StoreTenantCatalog> logger, Abblix.Oidc.Server.Features.MultiTenancy.ITenantStore store, System.Collections.Generic.IEnumerable<Abblix.Oidc.Server.Features.MultiTenancy.ITenantsCheck> checks, System.Collections.Generic.IEnumerable<Abblix.Oidc.Server.Features.MultiTenancy.ITenantOpening> openings, System.Collections.Generic.IEnumerable<Abblix.Oidc.Server.Features.MultiTenancy.ITenantClosing> closings, Microsoft.Extensions.Options.IOptions<Abblix.Oidc.Server.Common.Configuration.OidcOptions> options, System.TimeProvider timeProvider);

Parameters

logger Microsoft.Extensions.Logging.ILogger<StoreTenantCatalog>

Records the tenants left out.

store ITenantStore

Where the tenants are read from.

checks System.Collections.Generic.IEnumerable<ITenantsCheck>

The checks of the tenant list. They must refuse an id held twice, as TenantDefinitionsCheck does, since the tenants served are kept by id.

openings System.Collections.Generic.IEnumerable<ITenantOpening>

What readies each tenant the checks pass before it is first served.

closings System.Collections.Generic.IEnumerable<ITenantClosing>

What lets go of each tenant once it is released.

options Microsoft.Extensions.Options.IOptions<OidcOptions>

How long the openings of one reading may take, and how long a tenant gone from the store is kept.

timeProvider System.TimeProvider

Tells how long a tenant has been gone from the store.

Remarks

Asked on every request, static files included, so it answers from the last reading and never from the store. A tenant whose id, generation and version are unchanged keeps the definition read before, so what was built from it is not built again. What was built for a tenant from its definition in force (Abblix.Oidc.Server.Features.MultiTenancy.StoreTenantCatalog.InForce(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition)) is not replaced from another definition, so a request still holding one this catalog replaced is answered with what was built.

Methods

StoreTenantCatalog.FindByAddressAsync(string, string, CancellationToken) Method

The tenant served at host and path: the one whose issuer names that host and, among those, the longest whole-segment start of the path; null when no issuer covers it.

C#
public System.Threading.Tasks.ValueTask<Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition?> FindByAddressAsync(string host, string path, System.Threading.CancellationToken cancellationToken);

Parameters

host System.String
path System.String
cancellationToken System.Threading.CancellationToken

Implements FindByAddressAsync(string, string, CancellationToken)

Returns

System.Threading.Tasks.ValueTask<TenantDefinition>

StoreTenantCatalog.FindByIdAsync(string, CancellationToken) Method

The tenant registered under tenantId, compared exactly, or null when there is none.

C#
public System.Threading.Tasks.ValueTask<Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition?> FindByIdAsync(string tenantId, System.Threading.CancellationToken cancellationToken);

Parameters

tenantId System.String
cancellationToken System.Threading.CancellationToken

Implements FindByIdAsync(string, CancellationToken)

Returns

System.Threading.Tasks.ValueTask<TenantDefinition>

StoreTenantCatalog.RefreshAsync(CancellationToken) Method

Reads the store again and serves what the checks let through.

C#
public System.Threading.Tasks.Task RefreshAsync(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task

StoreTenantCatalog.Released(TenantDefinition) Method

The token canceled once the store no longer holds the creation of tenant and one refresh period has passed, for what the server keeps in memory for it to be let go; canceled already for a creation the last reading released, and never for one the store has not listed.

C#
public System.Threading.CancellationToken Released(Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant);

Parameters

tenant TenantDefinition

Returns

System.Threading.CancellationToken

StoreTenantCatalog.ReleasedOf(ITenantCatalog, TenantDefinition) Method

The token Released(TenantDefinition) gives when catalog is this server's own; none that is ever canceled for a catalog of the host's own, which this server cannot tell a tenant is gone from.

C#
public static System.Threading.CancellationToken ReleasedOf(Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog catalog, Abblix.Oidc.Server.Features.MultiTenancy.TenantDefinition tenant);

Parameters

catalog ITenantCatalog
tenant TenantDefinition

Returns

System.Threading.CancellationToken