Authenticate and Interact with a Tenant
To authenticate with a tenant you need to create a tenant API key and use the key to configure an ApiClient object.
Create a tenant API key
Create an API key for a tenant so that you can use the API to automate tasks on the tenant. You use the primary manager to create the tenant key, so to perform the operation you authenticate with the primary manager. When the tenant key is created, it appears in the Deep Security Manager of the tenant account.
If you do not set the roleID for the key, the key is provided full access.
The process to create an API key for a tenant is similar to that for creating an API key for the primary tenant. (See Create an API Key Using Code.)
- Create an ApiKey object and configure the properties.
- Create a TenantsApi object and use it to create the API key on the tenant.
See example code: Python, JavaScript, Java
Also see the Generate an API Key for the Tenant operation in the API Reference.
Configure an ApiClient object for a tenant
Configure the ApiClient to use the secret key of the tenant's API key and
then send requests to the Deep Security Manager of the tenant. From the secret key, the
manager determines which tenant you are targeting.
After you configure the ApiClient, all calls are authenticated using the tenant's API key and the calls target the associated tenant. After you are done interacting with the tenant and you want to make calls to the primary tenant, configure the ApiClient to use an API key for the primary tenant.
See example code: Python, JavaScript, Java
Obtain Intrusion Prevention states of tenant computers
The following example demonstrates how to authenticate and interact with a tenant:
- Creates an API key on the tenant.
- Configures ApiClient to use the tenant API key.
- Obtains the Intrusion Prevention information from each computer that the tenant protects.
- Configures ApiClient to use the API key of the primary tenant.
Tenant keys expire 6 hours after creation by default.
See example code: Python, JavaScript, Java
Example: add a policy to a tenant
Create and configure policies for tenants in the same way that you do for the primary Deep
Security Manager, except that you use a tenant API key for authentication. The following
example creates an API key for a tenant and then uses the key to configure an
ApiClient object. The client interacts with the tenant's Deep Security
Manager.
For more information about using the API to work with policies, see Create and configure policies.
See example code: Python, JavaScript, Java
