Skip to content

Tenancy: clients, anchors and partners

FlowCatalyst is multi-tenant. One platform serves many businesses, keeps their data and their people apart, and still lets the platform’s own staff and trusted partners work across them. Three ideas make that work: clients (the tenants), tiers (how far a principal reaches across clients) and entitlements (which applications a client uses).

A client (clt_) is one business served on the platform, for example “Acme Retail”. It has a name, a lower-case identifier (a slug such as acme) and a status: ACTIVE, INACTIVE or SUSPENDED.

The identifier is the human-friendly handle. It appears in queue and dispatch pool names, it is sent with every delivery as clientCode, and most APIs that take a client accept either the clt_ id or the identifier.

Most data hangs off a client:

  • Users have a home client, unless they reach more than one client.
  • Events carry the client they belong to, and so do the dispatch jobs made from them.
  • Subscriptions, connections and dispatch pools are either bound to one client or global. A client-bound subscription matches only that client’s events; a global one matches every client’s.
  • Platform configuration can hold a global value and a per-client value (configuration and secrets).
  • Portal identities and field workers each belong to one client (portal identity, field workers).

Do not confuse a client with an OAuth client (oac_), a registered OAuth 2.0 application. The two share a word and nothing else.

Every principal has a tier, which says which clients it may act for:

Tier Reaches Typical holders
ANCHOR Every client, present and future Platform staff and operators; application service accounts
PARTNER The clients explicitly granted to it An agency or a logistics partner serving several clients
CLIENT Its one home client A client’s own staff

The tier travels in tokens as the tier claim. The client list travels as the clients claim: ["*"] for an anchor, and id:identifier pairs (for example clt_0HZXEQ5Y8JY5Z:acme) for a partner or a client-tier principal (tokens).

flowchart TB
  A["ANCHOR principal"]
  P["PARTNER principal"]
  subgraph c1["Client acme"]
    U1["CLIENT user"]
  end
  subgraph c2["Client globex"]
    U2["CLIENT user"]
  end
  subgraph c3["Client initech"]
    U3["CLIENT user"]
  end
  A --> c1
  A --> c2
  A --> c3
  P -- "grant" --> c1
  P -- "grant" --> c2

The diagram shows three clients. Each client user reaches only its own client, the partner reaches the two clients it holds grants for, and the anchor reaches all three.

An anchor domain is an email domain registered as the platform operator’s own, for example example-platform.com. Creating an ANCHOR user requires the email’s domain to be a registered anchor domain, or to be mapped to an identity provider with the ANCHOR mapping scope. Otherwise the request fails with ANCHOR_DOMAIN_REQUIRED. Nobody can make a cross-tenant account for an address the operator does not control.

A partner’s reach is a list of client access grants, one per client, each recording who granted it and when. Creating a PARTNER user requires a PARTNER email-domain mapping for the email’s domain, and the client must be one that mapping allows. Creating a partner who already exists adds a grant to the existing user instead of making a second account.

A client’s administrators can see the partners granted their client, read-only. Only the platform’s administrators can change a partner.

Section titled “Service accounts follow their client links”

A service account’s tier comes from the clients it is linked to: no links makes it ANCHOR, one link makes it CLIENT confined to that client, and several make it PARTNER with one grant each. A service account provisioned for an application has no client links, so it is anchor-tier and works for every client that uses the application.

Changing which clients a user reaches is reserved. Changing a user’s tier, their home client or their client grants, and creating a PARTNER or ANCHOR user at all, needs the platform:iam:user:manage-access permission and the anchor tier. A client administrator never holds it, so a client administrator can only create client-tier users in their own client.

A tier says where a principal may act. It never says what it may do. That comes only from the principal’s roles and the permissions in them (permissions and roles).

Every platform check asks two questions:

  1. Reach. Does the caller’s tier cover the resource’s client? An anchor passes, a partner passes for a granted client, and a client-tier caller passes for its home client.
  2. Authority. Does the caller hold the permission for the operation? The anchor tier does not answer this. An anchor-tier operator with a read-only role cannot write.

A platform-level resource (one with no client, such as a global subscription) also needs anchor reach or the super-admin permission.

Why the two are kept apart. If tier implied authority, every anchor-tier account would hold every permission, and every application service account would be a platform administrator. Keeping reach and authority separate lets a service account serve all clients while doing only what its role allows, and lets an operator see everything without being able to change everything.

Out-of-reach answers look like “not found”

Section titled “Out-of-reach answers look like “not found””

When a caller asks by id for a principal outside its reach, the platform answers 404 exactly as it would for an id that does not exist, not 403. A client administrator who guesses an anchor user’s id learns nothing, not even that the id is real. An application’s credential gets the same answer for an event, a job or a user that belongs to another application.

Clients are one axis of reach. Applications are a second, independent one: a principal reaches either every application (the applications claim is ["*"]) or a listed set. Users reach every application by default. An application’s service account is pinned to its own application while staying anchor-tier for clients. See applications.

A client uses an application once it is entitled to it. The entitlement is a client config: one row per application and client, enabled or disabled. Enabling an application for a client is an anchor-level action.

Entitlement does three jobs:

  • It bounds delegation. A client administrator can assign any role of any application the client is entitled to, and nothing else: never a platform role (PLATFORM_ROLE_FORBIDDEN) and never a role of an application the client does not use (ROLE_APP_FORBIDDEN). They do not need to hold those roles themselves.
  • It defines an application’s users. For an application’s own admin pages, its users are the client-tier users homed at a client the application is enabled for who hold at least one of its roles.
  • It records the relationship. The console shows which clients use which applications.
  • One identity, many tenants. A partner who serves three clients has one account with three grants, not three accounts and three passwords. Removing a grant removes access in one place.
  • Delegation stays inside the walls. Client administrators manage their own users, roles and portal users. Every check confines them with the same reach rule, so delegation never crosses tenants and never hands out platform authority.
  • The server decides. The platform derives the tier and clients claims from the stored principal when it mints a token, signs the token, and checks reach on every request. A token cannot be edited into more reach, and a change of grants applies to the next token minted.