Skip to content

Several Tenants ​

For a deployment with more than one customer, to see where a document's reach ends. This page puts three tenants on one platform and shows three facts, each a scenario that runs on every build: a platform policy reaches every tenant, a tenant's binding reaches only its own principals, and a boundary can cap what one tenant may be permitted.

What you need ​

Several tenants
DocumentsOne platform document, and one tenant document each for acme, globex and initech
TokensEach principal's token carries its tenantId: a principal is evaluated only against its own tenant's document
ConceptsTenant, Platform boundary, Tenant isolation

The documents ​

The platform document holds what every tenant shares: one policy, bound to everyone, and two boundaries. boundary-standard is the default and lets GET and POST on /api/** stand; boundary-read-only lets only GET stand.

json
{
  "schema": 2,
  "revision": 1,
  "publishedAt": "2026-11-01T08:00:00Z",
  "boundaries": {
    "default": "boundary-standard"
  },
  "policies": [
    {
      "id": "read-orders",
      "statements": [
        {
          "name": "read-orders",
          "effect": "allow",
          "action": "http:GET",
          "resource": "http:path:/api/orders"
        }
      ]
    },
    {
      "id": "boundary-standard",
      "boundary": true,
      "statements": [
        {
          "effect": "allow",
          "action": [
            "http:GET",
            "http:POST"
          ],
          "resource": "http:path:/api/**"
        }
      ]
    },
    {
      "id": "boundary-read-only",
      "boundary": true,
      "statements": [
        {
          "effect": "allow",
          "action": "http:GET",
          "resource": "http:path:/api/**"
        }
      ]
    }
  ],
  "bindings": [
    {
      "id": "read-orders",
      "subject": "*",
      "app": "*",
      "space": "*",
      "policy": "read-orders"
    }
  ]
}

acme binds its own policy to everyone, in its own document. It lets a principal of acme POST /api/export:

json
{
  "schema": 2,
  "revision": 1,
  "publishedAt": "2026-11-01T08:00:00Z",
  "policies": [
    {
      "id": "acme-export",
      "statements": [
        {
          "name": "export",
          "effect": "allow",
          "action": "http:POST",
          "resource": "http:path:/api/export"
        }
      ]
    }
  ],
  "bindings": [
    {
      "id": "acme-export",
      "subject": "*",
      "app": "*",
      "space": "*",
      "policy": "acme-export"
    }
  ]
}

globex binds the same kind of policy, and names boundary-read-only as the boundary that holds it:

json
{
  "schema": 2,
  "revision": 1,
  "publishedAt": "2026-11-01T08:00:00Z",
  "boundary": "boundary-read-only",
  "policies": [
    {
      "id": "globex-export",
      "statements": [
        {
          "name": "export",
          "effect": "allow",
          "action": "http:POST",
          "resource": "http:path:/api/export"
        }
      ]
    }
  ],
  "bindings": [
    {
      "id": "globex-export",
      "subject": "*",
      "app": "*",
      "space": "*",
      "policy": "globex-export"
    }
  ]
}

initech has a document and nothing in it, so only what the platform grants everyone reaches it:

json
{
  "schema": 2,
  "revision": 1,
  "publishedAt": "2026-11-01T08:00:00Z"
}

Check it ​

The scenarios in wiki/examples/several-tenants run on every build:

CallerRequestResult
alice of acmeGET /api/ordersPermit: the platform policy read-orders is bound to everyone
gina of globexGET /api/ordersPermit: the same policy, for another tenant
alice of acmePOST /api/exportPermit: acme's own binding
ivan of initechPOST /api/exportDeny, implicit: the binding is in acme's document, and initech's has none
gina of globexPOST /api/exportDeny, by the boundary: globex binds the permit, but boundary-read-only has no statement for POST

What each says:

  • A platform binding is every tenant's. The platform document applies to all principals, whatever their tenant; put in it only what every tenant may have.
  • A tenant's binding stays in its tenant. A principal is evaluated against its own tenant's document, so acme's Anyone binding means "anyone in acme", never anyone in initech. Tenants cannot see or change each other's documents (Tenant isolation).
  • A boundary caps; it never grants. A permit stands only if a statement of the tenant's boundary also matches. Use it for a ceiling the platform sets whatever a tenant writes, such as a tenant on a read-only plan.

Licensed under the Apache License, Version 2.0.