Skip to content

TenantPartitionedRateLimiter<TResource> Class

Spends a budget the server keeps per caller - failed client authentications, introspection and revocation requests - separately for each tenant.

C#
public sealed class TenantPartitionedRateLimiter<TResource> : System.Threading.RateLimiting.PartitionedRateLimiter<TResource>

Type parameters

TResource

What the budget is partitioned by.

Inheritance System.Object → System.Threading.RateLimiting.PartitionedRateLimiter<TResource> → TenantPartitionedRateLimiter<TResource>

Remarks

The budget is partitioned by what it is spent on, a client id or a source address, which two tenants can share: without this, attempts against one tenant's client would spend another tenant's client of the same id. Each tenant gets a limiter of its own, built the way the budget was registered, so the resource reaches it as the server produced it - a host's own limiter partitions by the address or client it was written for.

Constructors

TenantPartitionedRateLimiter(Func<PartitionedRateLimiter<TResource>>, ITenantAccessor, ITenantCatalog) Constructor

Spends a budget the server keeps per caller - failed client authentications, introspection and revocation requests - separately for each tenant.

C#
public TenantPartitionedRateLimiter(System.Func<System.Threading.RateLimiting.PartitionedRateLimiter<TResource>> createLimiter, Abblix.Oidc.Server.Features.MultiTenancy.ITenantAccessor tenantAccessor, Abblix.Oidc.Server.Features.MultiTenancy.ITenantCatalog catalog);

Parameters

createLimiter System.Func<System.Threading.RateLimiting.PartitionedRateLimiter<TResource>>

Builds a new limiter for a tenant that has none yet.

tenantAccessor ITenantAccessor

Names the tenant a budget is spent for.

catalog ITenantCatalog

Tells when a tenant is released, and its limiter with it.

Remarks

The budget is partitioned by what it is spent on, a client id or a source address, which two tenants can share: without this, attempts against one tenant's client would spend another tenant's client of the same id. Each tenant gets a limiter of its own, built the way the budget was registered, so the resource reaches it as the server produced it - a host's own limiter partitions by the address or client it was written for.

Methods

TenantPartitionedRateLimiter<TResource>.GetStatistics(TResource) Method

Gets a snapshot of the statistics for the resource if available.

C#
public override System.Threading.RateLimiting.RateLimiterStatistics? GetStatistics(TResource resource);

Parameters

resource TResource

Returns

System.Threading.RateLimiting.RateLimiterStatistics
An instance of System.Threading.RateLimiting.RateLimiterStatistics containing a snapshot of the statistics for a resource.