Member Junction
    Preparing search index...

    Function attachTenantContext

    • Attaches TenantContext to a UserInfo object. Called from the GraphQL context function after authentication.

      The caller is responsible for two invariants (createTenantMiddleware shows both): validate untrusted tenant ids with IsValidTenantId BEFORE calling, and never pass the shared cached UserInfo — clone it first (CloneUserForSessionContext). This function still validates as defense in depth so a future caller from a different source ('linkedEntity', 'custom') cannot reintroduce the injection path.

      Parameters

      • user: UserInfo
      • tenantId: string
      • source: "header" | "linkedEntity" | "custom"

      Returns void