Authenticating to the REST API
The REST API is hosted at this base URL:
https://{addr}/api/v1
The specification is available here.
You can use the REST interface via curl, or from the API Guide embedded in the CipherTrust Data Security Platform Service UI.
To copy and paste the following example commands, set an environment variable to point to your CipherTrust Data Security Platform Service instance:
API token generation for User Credentials
You can generate an API token with a user's username, password, and tenant.
For example, this command uses the user admin
's credentials to create an API token for the my_tenant
CSDPaaS tenant:
The response:
Copy the value of the jwt property into another environment variable:
Using the jq tool, we can fetch, extract, and export the token in a single shell command:
We can use that API token to make other calls:
REST API Client Registration and API Token Generation for Client Credentials
You can register a REST API client to improve monitoring and traceability on the client's actions. Registered clients can exchange their client identities and client certificates for an API token for authentication through the REST API.
Registration is especially beneficial for automated clients which act without a person initiating operations.
If you register the REST client, its client identity is recorded in the DPoD audit query records. Theclient_id
value is included in the audit query records whenever a registered or public client receives an authentication token.
Registering a REST API client
-
Create a registration token on CipherTrust Data Security Platform Service using the client profile. You must retain the registration token.
The registration token is a randomly generated character string used to register a client.
-
With the REST client, make a
POST /v1/client-management/clients
to register the client.Provide the registration token and certificate-related parameters. The specification file and API Guide embedded in the CipherTrust Data Security Platform Service GUI has full schema descriptions for this endpoint. The example request demonstrates providing a CSR for CipherTrust Data Security Platform Service to sign.
Example request
Retain the ID value in the response. This represents the client identity required to obtain a token.
API Token Generation with Client Identity
To issue an API token for a client identity, you must specify grant_type:"client_credential"
and client_id:<client_identity>
in the data
part of the request. The client identity is obtained during client registration.
In addition, the public certificate file path and private key file path are provided in the request to ensure that the client certificate is verified. These values correspond with the client certificate configuration that took place when creating a client profile and registering the client.
For example, this command generates an API token for the client 123456789, provided the presented identity and client certificate match the expected values in the client registration:
The response:
Copy the value of the jwt property into another environment variable:
We can use that API token to make other calls: