TenantRejectedContext<TKey> class
Namespace: Tenantry.AspNetCore · Package: Tenantry.AspNetCore · API reference
A request that app.UseTenantry() rejects, passed to TenantResolutionOptions<TKey>.OnRejected.
TenantRejectedContext<TKey>.Reason is the actual reason, for your logs. With access validators, a request whose tenant does not exist gets the response of one whose tenant it may not use (TenantRejectedContext<TKey>.StatusCode is the access-denied status), so a caller cannot find out which tenants exist: keep that in a response of your own.
public sealed class TenantRejectedContext<TKey> where TKey : IEquatable<TKey>, IParsable<TKey>Type parameters
TKey: The tenant identifier type.
Properties
HttpContext
The request.
public HttpContext HttpContext { get; }Value: HttpContext
Identifier
The identifier the request sent, or null when it sent none. It is request input: do not repeat it in a response without encoding it.
public string? Identifier { get; }Value: string
IsHandled
Whether TenantRejectedContext<TKey>.HandleResponse was called.
public bool IsHandled { get; }Value: bool
Reason
Why the request is rejected.
public TenantRejectionReason Reason { get; }Value: TenantRejectionReason
StatusCode
The status code of Tenantry's response, from TenantResolutionOptions<TKey>. Change it to send another.
public int StatusCode { get; set; }Value: int
Tenant
The tenant an access validator refused, or null for any other reason.
public ITenantDescriptor<TKey>? Tenant { get; }Value: ITenantDescriptor<TKey>
Methods
HandleResponse()
Tells Tenantry that the handler wrote the response, so it writes none.
public void HandleResponse()