How to make requests in a multi-tenant environment
- Orchestrate running with multi-tenancy enabled.
Setting the tenant ID and username
In production, the custom claim used to generate the JWT is provided by an identity provider such as Auth0. The custom claim specifies a
tenant_ID, a value indicating the authorized tenant, and a
username, an optional value specifying individual users.
The value for
tenant_ID can be:
_, which grants access only to resources available to all tenants (public resources).
A specific tenant name, which grants access to the tenant identities and keys, plus the public resources belonging to tenant
*, which grants access to all resources regardless of restriction (this is like root access, so be careful using it).
When receiving a request, once the server has successfully performed standard checks on the JWT, it extracts the
tenant_ID and a
X-Tenant-ID header that is optionally set by the client indicating the tenant to impersonate. The combination of these two values determines to whose resources access is granted, as shown in the following table (using
bar as example tenant names):
|tenant_ID||X-Tenant-ID||Read access||Write access|
|empty||all tenants, |
|all tenants, |
You can define more advanced access levels by using nested tenants in combination with
username to restrict access to resources by group and individual privileges. Resources you can restrict include chains, accounts, and transactions.
: to identify each additional level of access with
tenant_ID and the optional
X-Tenant-ID. Each nested level gives access to the resources of itself and the previously listed level. The following table shows examples for three levels of nesting.
|Level of access|
A user with
username=userOne claims has access to
Make a request
Simply pass the Bearer token as part of the
Authorization header when doing an HTTP call or fill the
authToken parameter when using the JS SDK.
- REST Request
curl --location --request GET 'https://orchestrate.consensys.net/chains' \
--header 'Authorization: Bearer eyJh...JoVg'
const authToken = "eyJhb...JoVg";
const chain = await chainRegistry.registerChain(chainRequest, authToken);
The Quorum Developer Quickstart showcases usage of the multi-tenancy.