Docs
Tenantry CoreAPI reference

ClaimTenantResolver class

Namespace: Tenantry.AspNetCore · Package: Tenantry.AspNetCore · API reference

Resolves the tenant from a claim on the current request principal.

public sealed class ClaimTenantResolver : ITenantResolver

Implements ITenantResolver.

Constructors

ClaimTenantResolver(string)

Resolves the tenant from a claim on the current request principal.

public ClaimTenantResolver(string claimType = "tenant_id")

Parameters:

  • claimType string: The type of the claim that carries the tenant identifier.

Methods

ResolveAsync(HttpContext, CancellationToken)

Attempts to read a tenant identifier from the current request.

public ValueTask<string?> ResolveAsync(HttpContext context, CancellationToken cancellationToken = default)

Parameters:

  • context HttpContext: The current HTTP context.
  • cancellationToken CancellationToken: Cancellation token.

Returns: ValueTask<string>: The identifier, or null (or an empty string) if this resolver cannot determine the tenant from the current request. Return it as the request carries it: the tenant store finds the tenant it names.

On this page