Expand description
TenantResolver — derives a sealed Tenant from an AuthContext.
The framework invokes a TenantResolver once per request, after
SessionValidator::validate produces the AuthContext and before
method-scope authorization runs. The resulting Tenant flows through
the dispatch as an extension; activation methods that declare a
&Tenant parameter extract it from there.
Two reference implementations are provided:
-
ClaimTenantResolver— the 80% case: pull a configured claim out ofAuthContext.metadata(default key:"tenant_id"). When the claim is absent andsingle_user_fallbackis true, fall back to the verified user id (single-user-deployment safe default). -
SingleTenantResolver— the explicit opt-out: always resolve to one fixed tenant value, regardless of the caller. Use this for single-user dev installs that want tenancy off; the opt-out is grep-able in the hub builder.
See plans/AUTHZ/AUTHZ-DATA-S01-output.md §2 for the trait design.
Structs§
- Claim
Tenant Resolver - Reference impl: derive the tenant from an
AuthContextclaim. - Single
Tenant Resolver - Reference impl: always resolve to one fixed tenant.
Traits§
- Tenant
Resolver - Derives a sealed
Tenantfor an authenticated caller.