Skip to main content
Table of Contents

Interface ICrossTenantAuthorizer

Namespace
Stratara.Abstractions.Multitenancy
Assembly
Stratara.Abstractions.dll

Authorizes a privileged cross-tenant operation — one where the acting principal's tenant (ActorTenantId) differs from the data-owner tenant (TenantId). Consulted by the tenant-isolation pipeline behavior when it runs in strict mode and observes such a divergence.

public interface ICrossTenantAuthorizer
Extension Methods

Remarks

Stratara ships a deny-all default, so strict mode forbids every cross-tenant operation until a consumer registers its own implementation. A typical implementation grants the divergence only to a platform-administrator principal (e.g. a role check). Because the in-process query path runs at the HTTP endpoint, an implementation there can read the current ClaimsPrincipal; the worker-side command path (outbox → worker) has no HTTP context, so an implementation that must run there should base its decision on data carried by the SessionContext rather than ambient request state.

Register the implementation with the DI container; the default deny-all is added via TryAdd so any consumer registration wins.

Methods

IsCrossTenantAllowedAsync(SessionContext, CancellationToken)

Decide whether the current principal may operate across tenants for the given session.

ValueTask<bool> IsCrossTenantAllowedAsync(SessionContext session, CancellationToken cancellationToken = default)

Parameters

session SessionContext

The ambient session whose actor and data-owner tenants diverge.

cancellationToken CancellationToken

Token to observe while authorizing.

Returns

ValueTask<bool>

true to permit the cross-tenant operation; false to reject it.