Authentication service
The Authentication service enables you to manage authentication tokens for running API commands.
authentication token::create
Creates an authentication token for the logged-in user.
A successful response returns a token value, as well as several additional token properties.
You specify this token in subsequent API requests.
Note
You must specify a token even in the API request for creation of a new token. Therefore, creation of your very first API token must be performed through the Helix Control-M user interface, as described in Creating an API Token in the Helix Control-M documentation. After creating an initial token through the UI, you can proceed with all other token management tasks through the API.
CLI Syntax
ctm authentication token::create -f <tokenDefinition.json>
Where <tokenDefinition.json> is the full path and name of a .json payload file that contains token details. Here is an example for the content of this file:
{
"tokenName": "emuser1-token",
"expirationDate": "2020-12-02",
"roles": ["Admin","User"]
}
The following parameters are used to define token data in the .json file:
Parameter | Description |
---|---|
tokenName | A unique name for the token |
expirationDate | A future date when the token will expire, in YYYY-MM-DD format Expiration is based on the UTC timezone. If you do not specify this property, the default is no expiration. |
roles | A list of roles for which the token grants access The logged-in user must be a member of all specified roles. This parameter is mandatory, that is, you must specify at least one role. |
If annotation is enabled for the Scheduling definitions, Configuration management, or Control-M security category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Content-Type: application/json" -H "x-api-key: $token" -X POST "$endpoint/authentication/token" -d @tokenDefinition.json
authentication token::update
Updates an authentication token of the logged-in user.
A successful response returns an updated list of token properties.
CLI Syntax
ctm authentication token::update -f <tokenDefinition.json>
Where <tokenDefinition.json> is the full path and name of a .json payload file that contains token details.
The contents of this file for an update request are the same as for a creation request. Note the following guidelines for an update action:
- You can update the expiration date of the token and the roles associated with the token. You cannot modify the name of the token.
- All parameters must be included in the .json file, even those that you are not updating.
To obtain current values of all parameters, you can use one of theget
commands before running an update action.
If annotation is enabled for the Scheduling definitions, Configuration management, or Control-M security category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Content-Type: application/json" -H "x-api-key: $token" -X PUT "$endpoint/authentication/token" -d @tokenDefinition.json
authentication token::delete
Deletes an authentication token of the logged-in user.
CLI Syntax
ctm authentication token::delete <tokenName>
If annotation is enabled for the Scheduling definitions, Configuration management, or Control-M security category in Control-M, you must also provide an annotation to justify your action. For more information, see Annotation input.
REST API Syntax
See REST API reference.
Example using curl:
tokenName=myToken
curl -H "Content-Type: application/json" -H "x-api-key: $token" -X DELETE "$endpoint/authentication/token/$tokenName"
authentication token::get
Retrieves details of an authentication token of the logged-in user.
CLI Syntax
ctm authentication token::get <tokenName>
REST API Syntax
See REST API reference.
Example using curl:
tokenName=myToken
curl -H "Content-Type: application/json" -H "x-api-key: $token" "$endpoint/authentication/token/$tokenName"
authentication tokens::get
Retrieves a list of authentication tokens for the logged-in user, including the details of each token.
CLI Syntax
ctm authentication tokens::get
REST API Syntax
See REST API reference.
Example using curl:
curl -H "Content-Type: application/json" -H "x-api-key: $token" "$endpoint/authentication/tokens"
Comments
Log in or register to comment.