Documentation / @zerotal/tenancy / TenantResolver
Interface: TenantResolver
Defined in: tenancy/src/types.ts:40
Properties
trusted?
readonlyoptionaltrusted?:boolean
Defined in: tenancy/src/types.ts:63
Whether the identifier this resolver produces is already known to belong to the requester — i.e. it came from server-held state rather than from the request.
Only AuthResolver is trusted: it reads the tenant off the authenticated
user's own record. Subdomains, headers, path segments and route params are all
attacker-chosen, so TenancyMiddleware requires an authenticated requester to be a
member of the tenant they named before opening the boundary. Without that check, a
user of tenant A reaches tenant B's data by editing one header.
Defaults to false — a custom resolver is untrusted until it says otherwise, which is
the right way round for a security default.
Methods
resolve()
resolve(
http):TenantResolverResult|null
Defined in: tenancy/src/types.ts:48
Return an identifier if this resolver can handle the request, or null to skip.
Resolvers receive the full HttpContext so they can read route params
(http.params), the authenticated user (http.user), headers, or the raw
http.request — whichever they resolve from.
Parameters
http
Returns
TenantResolverResult | null