/auth/v1/token: GET
Gets authentication token for the user.
The following table shows which roles can access this REST API endpoint:
Data admin | Data user | Collection Admin | Admin | Service user |
---|---|---|---|---|
✓ | ✓ | ✓ | ✓ | ✓ |
Synopsis of the request URL
Users from an external LDAP or COS domain must include domain name in the user name as <domain>/<user> to get an authentication token.
curl -k -u ldap/user1:pass https://<spectrum_discover_host>/auth/v1/token -v
curl -k -u cos/user1:pass https://<spectrum_discover_host>/auth/v1/token -v
curl -k -u cos/<access_key_id>:<secret_key> https://<spectrum_discover_host>/auth/v1/token -v
Without specifying domain name as part of user name:
curl -k -u user1:pass https://<spectrum_discover_host>/auth/v1/token -v
Note: When using curl, add the -v parameter to see the response headers that
contain the token.
Supported request types and response formats
Supported request types:
- GET
- JSON
Default response data is in CSV format. For results in JSON format, use the "Accept: application/json" header.
Examples
The following example shows a request and the corresponding response.
Request that contains domain as part of the user name:
curl -k -u ldap/user1:pass https://<spectrum_discover_host>/auth/v1/token -v
Request that does not contain domain as part of the user name:
curl -k -u user1:pass https://<spectrum_discover_host>/auth/v1/token -v
Response:
< HTTP/1.0 200 OK
< X-Auth-Token: gAAAAABbUdgLOLk67Zk_XQO0bbJt_qe4suz449m7XLM-D6e0jUzDxBW574L38y5xF5y3wc-
Xq0Bp43uQH13QN-wTsioPoOfOlbyrN5avBag2iHUkCOgXyA46TvY5LdGu46LEs-gO-
qidQgUCg5im4QF3Zvw5enCTvQd2N1bAg186CVOc8Qk5o1ldJGd51nL3ELts0LsVg9F4oPhv9HixwZflhlCsuPg1Gw
< Content-Type: text/html; charset=utf-8
< Content-Length: 0
< Server: Werkzeug/0.14.1 Python/2.7.5
< Date: Fri, 20 Jul 2018 12:39:39 GMT
You need to use the token that is obtained in the previous step to access the services offered by IBM Spectrum® Discover.
The following example shows how to use the token that is obtained to get the list of from the policy engine:
curl -v -k -H ‘Authorization: Bearer gAAAAABbUdgLOLk67Zk_XQO0bbJt_qe4suz449m7XLM-
D6e0jUzDxBW574L38y5xF5y3wc-Xq0Bp43uQH13QN-wTsioPoOfOlbyrN5avBag2iHUkCOgXyA46TvY5LdGu46LEs-
gO-qidQgUCg5im4QF3Zvw5enCTvQd2N1bAg186CVOc8Qk5o1ldJGd51nL3ELts0LsVg9F4oPhv9HixwZflhlCsuPg1Gw’
https://<spectrum_discover_host>/policyengine/v1/policies