HeaderTenantResolver class
Namespace: Tenantry.AspNetCore · Package: Tenantry.AspNetCore · API reference
Resolves the tenant from a request header (e.g. X-Tenant-Id).
public sealed class HeaderTenantResolver : ITenantResolverImplements ITenantResolver.
Constructors
HeaderTenantResolver(string)
Resolves the tenant from a request header (e.g. X-Tenant-Id).
public HeaderTenantResolver(string headerName)Parameters:
headerNamestring: The name of the header 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:
contextHttpContext: The current HTTP context.cancellationTokenCancellationToken: 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.
ClaimTenantResolver class
Resolves the tenant from a claim on the current request principal.
HostTenantResolver class
Resolves the tenant from the request's host name, for tenants that bring their own domain: a request to app.acme.com has the identifier app.acme.com, which your tenant store's ITenantStore<TKey>.FindByIdentifierAsynctenantry-itenantstore.md maps to a tenant.