IdM-Keyrock REST API¶
This section defines specific IdM-Keyrock requests required in IotCrawler environment. Further information can be found in the Keyrock Apiary (https://keyrock.docs.apiary.io).
Table of contents
Generate/Obtain a new IdM Token¶
-
POST
/v1/auth/tokens
¶ Generate/Obtain a new IdM Token.
- Request Headers
Content-Type – application/json
- Request JSON Object
name (string) – IdM-Keyrock user. For example: “admin@test.com”
password (string) – IdM-Keyrock user password. For example: “1234”
Example request:
$ curl --location --request POST 'https://{{IdM-IP}}:{{IdM-Port}}/v1/auth/tokens' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "admin@test.com", "password": "1234" }'
Example response:
{ "token": { "methods": [ "password" ], "expires_at": "2020-07-21T10:02:19.256Z" }, "idm_authorization_config": { "level": "advanced", "authzforce": true } }
- Response Headers
X-Subject-Token – IdM-Keyrock token. For example: “cf41496e-d9b2-4f1f-8cba-f4efb3bf9abe”
Content-Type – application/json
- Status Codes
201 Created – Created
401 Unauthorized – Unauthorized
Obtain the IdM Token information¶
-
GET
/v1/auth/tokens
¶ Obtain the IdM Token information.
Example request:
$ curl --location --request GET 'https://{{IdM-IP}}:{{IdM-Port}}/v1/auth/tokens' \ --header 'X-Auth-token: cf41496e-d9b2-4f1f-8cba-f4efb3bf9abe' \ --header 'X-Subject-token: cf41496e-d9b2-4f1f-8cba-f4efb3bf9abe'
Example response: .. sourcecode:: json
- {
“access_token”: “cf41496e-d9b2-4f1f-8cba-f4efb3bf9abe”, “expires”: “2020-07-21T10:47:23.000Z”, “valid”: true, “User”: {
“scope”: [], “id”: “admin”, “username”: “admin”, “email”: “admin@test.com”, “date_password”: “2019-10-22T12:45:58.000Z”, “enabled”: true, “admin”: true
}
}
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – OK.
401 Unauthorized – Unauthorized