Authenticating the command line client using API Keys
You can use API Keys to authenticate the command line client
About this task
The purpose of the following scenario is to show how to create and use an API Key to successfully authenticate the command line client.
The scope of the scenario is to list every folder defined in an engine.
Procedure
- Log in to the Dynamic Workload Console and click the User icon.
- From the menu, select Manage API Keys.
- In Manage API Keys, select an engine from the list and click Apply.
-
Create an API Key:
Note: API Keys expire by default after 365 days. You can set a custom duration for API Keys by adding the following parameters to the {INST_DIR}/usr/servers/engineServer/resources/properties/TWSConfig.properties file:
wherecom.ibm.tws.dao.rdbms.apikey.expiring.timeout = n.days com.ibm.tws.util.jwt.apikey.expiration.date = n.dayscom.ibm.tws.dao.rdbms.apikey.expiring.timeout = n.daysdetermines the duration in days of any future API Key created, andcom.ibm.tws.util.jwt.apikey.expiration.date = n.daysdetermines when the status of future API Keys changes from Valid to Expiring.You need to restart WebSphere Application Server Liberty after adding the custom parameters and before creating new API Keys.
This process must be repeated every time you want to change the duration and status change interval of new API Keys. API Keys that have been already created cannot be modified.
-
Authenticate the command line client with the API
Key token:
-
Access the list of available folders using command line client.
-
Enter the command:
composer list folder=@.
-
Enter the command:
Results
You have accessed an engine from a command line client authenticated with an API Key.