Tenant-aware authorization: keep resource access inside the active tenant
Tenant-aware authorization enforces which customer or organization owns the resource in the current request; it is not enough to know that a user signed in or has a matching role. A user with a valid role must still be prevented from reading or changing another tenant's data. The server should bind the request's tenant context to resource ownership and apply that check to every access path.
Tenant-aware authorization: keep resource access inside the active tenant
Tenant-aware authorization enforces which customer or organization owns the resource in the current request; it is not enough to know that a user signed in or has a matching role. A user with a valid role must still be prevented from reading or changing another tenant's data. The server should bind the request's tenant context to resource ownership and apply that check to every access path.
This guide covers shared SaaS applications. Dedicated infrastructure and pooled databases are different implementation choices; adding a tenant_id field alone does not create isolation.
Validate the relationship on every request
Verify that the token issuer and subject identify a trusted user or service principal.
Confirm that the active tenant context was selected by the user or matches a validated organization membership.
Check that the user is active in that tenant and has the role or scope required for the requested action.
Compare the tenant that owns the requested record, file, queue item, or cache key with the active tenant context.
Explicitly establish the tenant context for background jobs, exports, webhooks, and administrator operations, and record it for audit.
Never choose a tenant solely from a client-supplied URL or path. The server must compare it with the authenticated relationship.
Choose token claims or an application lookup
Tenant identity and roles can be carried in validated token claims, or the application can look up the user's membership in its database. Claims can make a request decision simpler, but tokens and caches can retain old membership after a change. Application lookup can reflect current relationships, but requires decisions about database availability, cache consistency, and failure behavior. A user who belongs to several tenants is changing the actual authorization context when switching tenants. Recheck membership and role, and never reuse tenant-scoped caches, sessions, or background work under the new context.
Handle missing, mismatched, or cross-tenant requests
| Condition | Safe default |
|---|---|
| Token tenant and selected tenant differ | Deny, or start a trusted tenant-switch flow. |
| Resource tenant is missing or unverified | Block the read or write; do not infer permission. Treat it as a data-quality issue. |
| Resource owner differs from current context | Deny. Log an internal security event without revealing whether another tenant's record exists. |
| System administrator operation | Require explicit cross-tenant authority, purpose, approval/audit, and minimum scope. |
| Stale membership cache | Revalidate under expiry/invalidation policy; query authoritative state for high-risk actions. |
AWS SaaS Architecture Fundamentals explains that tenant isolation is separate from general authentication and authorization: tenant context must scope access to that tenant's resources. This is an architectural example, not a requirement to choose a particular infrastructure pattern.
Plan verification cases
Prepare distinct records in at least two test tenants and evaluate a normal user, restricted role in the same tenant, user from another tenant, user in multiple tenants, and a service principal. Cover reads, writes, deletes, search filters, bulk exports, and asynchronous jobs. This is a pre-execution checklist; no test result is claimed here.
References
AWS, [SaaS Architecture Fundamentals: Tenant Isolation](https://docs.aws.amazon.com/whitepapers/latest/saas-architecture-fundamentals/tenant-isolation.html)
Microsoft Learn, [Architectural approaches for identity in multitenant solutions](https://learn.microsoft.com/en-us/azure/architecture/guide/multitenant/approaches/identity)
Microsoft Learn, [Validate claims in applications and APIs](https://learn.microsoft.com/en-us/entra/identity-platform/claims-validation)