Manage UI sessions

The API allows you to manage certain aspects of UI sessions.

Currently, the API supports logging out a session.

Prerequisites

The following headers are required to manage UI sessions using the API:

Headers

  • Content-Type : application/json
  • Authorization : <<access_token>>

Log out a session

To log out of the system, POST a call to the following URL:

https://<<hostName>>/api/v1/auth/logout

The request body should follow the following model:

{
  "cookies": [
    {
      "name": "authn_ssid",
      "value": "{{ authn_ssid  }}",
      "comment": null,
      "domain": "{{ devDomain  }}",
      "maxAge": -1,
      "path": "{{ path  }}",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "AUTHN_TOKEN",
      "value": "{{ AUTHN_TOKEN  }}",
      "comment": null,
      "domain": "{{ devDomain  }}",
      "maxAge": -1,
      "path": "{{ path  }}",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "IDP_URI",
      "value": "{{ IDP_URI  }}",
      "comment": null,
      "domain": "{{ domain  }}",
      "maxAge": -1,
      "path": "{{ path  }}",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "TENANT_AUTHORIZATION",
      "value": "{{ TENANT_AUTHORIZATION  }}",
      "comment": null,
      "domain": "{{ devDomain  }}",
      "maxAge": -1,
      "path": "{{ path  }}",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "kronosAuthToken",
      "value": "{{ kronosAuthToken  }}",
      "comment": null,
      "domain": "{{ vanityDomain  }}",
      "maxAge": -1,
      "path": "{{ path  }}",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "JSESSIONID",
      "value": "{{ JSESSIONID  }}",
      "comment": null,
      "domain": "{{ vanityDomain  }}",
      "maxAge": -1,
      "path": "{{ path  }}",
      "secure": false,
      "version": 0,
      "httpOnly": false
    }
  ]
}

A successful call returns an HTTP 200 SUCCESS response. An unsuccessful call returns an HTTP 401 error response indicating that no session could be found associated with the data sent in the request payload.

Model properties

Notes:

  • The property path defaults to a value of "/" if no value is passed.

Required properties

The following properties are required:

  • name
  • value

Code examples

The following code examples demonstrate logging out a UI session using cURL and Java OkHttp.

Note: The follow examples include the entire request payload model, but only the name and value properties are required.

cURL

curl --location --request POST 'https://<<hostName>>/api/v1/auth/logout' \
--header 'Content-Type: application/json' \
--header 'Authorization: <<access_token>> \
--header 'Accept: */*' \
--data-raw '{
  "cookies": [
    {
      "name": "authn_ssid",
      "value": ""{{authn SSID}}"",
      "comment": null,
      "domain": "<<hostName>>",
      "maxAge": -1,
      "path": "/",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "AUTHN_TOKEN",
      "value": "{{authentication token}}",
      "comment": null,
      "domain": "<<hostName>>",
      "maxAge": -1,
      "path": "/",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "IDP_URI",
      "value": "{{IDP token}}",
      "comment": null,
      "domain": "mykronos.com",
      "maxAge": -1,
      "path": "/",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "TENANT_AUTHORIZATION",
      "value": "{{tenant authorization token}}",
      "comment": null,
      "domain": "<<hostName>>",
      "maxAge": -1,
      "path": "/",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "kronosAuthToken",
      "value": "{{kronos authorization token}}",
      "comment": null,
      "domain": "<<hostName>>",
      "maxAge": -1,
      "path": "/",
      "secure": false,
      "version": 0,
      "httpOnly": false
    },
    {
      "name": "JSESSIONID",
      "value": "{{JSessionId}}",
      "comment": null,
      "domain": "<<hostName>>",
      "maxAge": -1,
      "path": "/",
      "secure": false,
      "version": 0,
      "httpOnly": false
    }
  ]
}'

Java OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"cookies\": [\n    {\n      \"name\": \"authn_ssid\",\n      \"value\": \"\"{{authn SSID}}\"\",\n      \"comment\": null,\n      \"domain\": \"<<hostName>>\",\n      \"maxAge\": -1,\n      \"path\": \"/\",\n      \"secure\": false,\n      \"version\": 0,\n      \"httpOnly\": false\n    },\n    {\n      \"name\": \"AUTHN_TOKEN\",\n      \"value\": \"{{authentication token}}\",\n      \"comment\": null,\n      \"domain\": \"<<hostName>>\",\n      \"maxAge\": -1,\n      \"path\": \"/\",\n      \"secure\": false,\n      \"version\": 0,\n      \"httpOnly\": false\n    },\n    {\n      \"name\": \"IDP_URI\",\n      \"value\": \"{{IDP token}}\",\n      \"comment\": null,\n      \"domain\": \"mykronos.com\",\n      \"maxAge\": -1,\n      \"path\": \"/\",\n      \"secure\": false,\n      \"version\": 0,\n      \"httpOnly\": false\n    },\n    {\n      \"name\": \"TENANT_AUTHORIZATION\",\n      \"value\": \"{{tenant authorization token}}\",\n      \"comment\": null,\n      \"domain\": \"<<hostName>>\",\n      \"maxAge\": -1,\n      \"path\": \"/\",\n      \"secure\": false,\n      \"version\": 0,\n      \"httpOnly\": false\n    },\n    {\n      \"name\": \"kronosAuthToken\",\n      \"value\": \"{{authorization token}}\",\n      \"comment\": null,\n      \"domain\": \"<<hostName>>\",\n      \"maxAge\": -1,\n      \"path\": \"/\",\n      \"secure\": false,\n      \"version\": 0,\n      \"httpOnly\": false\n    },\n    {\n      \"name\": \"JSESSIONID\",\n      \"value\": \"{{JSessionId}}\",\n      \"comment\": null,\n      \"domain\": \"<<hostName>>\",\n      \"maxAge\": -1,\n      \"path\": \"/\",\n      \"secure\": false,\n      \"version\": 0,\n      \"httpOnly\": false\n    }\n  ]\n}");
Request request = new Request.Builder()
  .url("https://<<hostName>>/api/v1/auth/logout")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "<<access_token>>")
  .addHeader("Accept", "*/*")
  .build();
Response response = client.newCall(request).execute();

A successful call returns an HTTP 200 status code.