App staff authorization
Your own staff (support, operations, compliance reviewers) need to act inside your product's runtime: look up a customer, review a record, change a policy. This page defines how that authority is issued, how your app verifies it, and how fast it can be withdrawn. It is separate from two other kinds of people:
| Who | Where they work | How they sign in | Covered by |
|---|---|---|---|
| TenancyEngine operators | The platform itself | Platform console | Never issued into your app's runtime tokens. |
| Your team in the TenancyEngine console (owner, admin, billing, support, viewer on the application) | The TenancyEngine console, to configure your application | Platform console | Control plane only. These roles are not copied into any token your app receives. The platform keeps this team apart from organization members so a team role never grants organization-wide access. |
| Your customers' admins | Their own tenant inside your product | Your app's customer sign-in | Customer sign-in |
| Your app staff | Your product's runtime, across or inside tenants as you decide | Your app's sign-in | This page. |
Requires TenancyEngine.Sdk 2.3.0 for the sign-in building blocks and machine access (AddTenancyEngineMachineAccess, released in 2.1.0). Nothing on this page needs an unreleased type. A packaged verifier is planned in tenancyengine#1576.
The contract
Staff are tenant members with staff roles. Create a tenant that represents your staff organization (for example
acme-staff), define staff roles on your application (for examplesupport,compliance), and attach permission keys to each role. Staff sign in through the same customer sign-in as everyone else. Role definitions and permission keys are managed per application and environment (see the application's Roles and Claims pages in the console).Authority is the
permissionclaim. The platform puts the role's permission keys into the token as a JSON array in thepermissionclaim, alongsideapplication_id,environment,tenant_id,tenant_slugandrole. Name the keys in your own namespace (yourapp.staff.read,yourapp.policy.write).Your verifier decides, from the token alone. A staff-only route accepts a request when all of these hold:
- the token is valid: signature, expiry and issuer (the authority the platform reports for your environment);
application_idequals your application id andenvironmentequals your running environment;tenant_idis present and equals your staff tenant;permissioncontains the key the route needs;- the token has no
organization_id/organization_roleclaim. Those two appear only whentenant_idis absent, which is the shape of a TenancyEngine organization login. A route that requirestenant_idrejects that shape by construction.
Sample checks are in Customer sign-in.
Servers use machine access, not a person's token. Back-office jobs and customer servers that call your API use machine access: per-tenant credentials, tokens of at most 300 seconds, an audience bound to your application and environment, and permission scopes in your namespace. Verify them with
AddTenancyEngineMachineAccessandRequireTenancyEngineMachineScope("yourapp.sync.read"). A machine token is never a substitute for a person: it carries no individual identity, so actions that need an accountable person go through a signed-in staff member.
Revocation
There is no token introspection and no gateway call to ask "is this token still good". The bound on how long a withdrawn permission keeps working is the access-token lifetime (read exp from the token) plus, for a person who stays signed in on a session of yours, your own session lifetime.
- Removing a staff member from the staff tenant, or changing their role, takes effect in the next token the platform issues.
- The platform re-validates application, organization and tenant membership on every refresh-token grant, so a revoked member cannot refresh into a new token.
- An organization's security policy (session timeout, IP allowlist) is applied on refresh as well.
- If your app keeps its own session cookie, that cookie is your bound. Keep staff sessions short and do not use sliding expiry for them.
- For an action that must not outlive a revocation (policy changes, data export), re-check the person against the platform on the action itself, or require a token minted within the last few minutes (
iat).
Not provided
- A packaged verifier or authorization policy helper: tracked in tenancyengine#1576.
- Introspection or a per-request revocation endpoint for a person's access token.
- Staff roles that are issued into a customer's tenant: staff work in your staff tenant. If staff must see a customer's data, your app grants that access in its own database and records it in its own audit log (see Policy storage and audit).