2018-08-23 21:04:02 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[[security-api-get-privileges]]
|
|
|
|
=== Get application privileges API
|
2018-12-20 13:23:28 -05:00
|
|
|
++++
|
|
|
|
<titleabbrev>Get application privileges</titleabbrev>
|
|
|
|
++++
|
2018-08-23 21:04:02 -04:00
|
|
|
|
2019-10-07 18:23:19 -04:00
|
|
|
Retrieves <<application-privileges,application privileges>>.
|
2018-08-23 21:04:02 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-privileges-request]]
|
|
|
|
==== {api-request-title}
|
2018-08-23 21:04:02 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/privilege` +
|
2018-08-23 21:04:02 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/privilege/<application>` +
|
2018-08-23 21:04:02 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/privilege/<application>/<privilege>`
|
2018-08-23 21:04:02 -04:00
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-privileges-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
To use this API, you must have either:
|
|
|
|
|
|
|
|
- the `manage_security` cluster privilege (or a greater privilege such as `all`); _or_
|
|
|
|
- the _"Manage Application Privileges"_ global privilege for the application being referenced
|
|
|
|
in the request
|
|
|
|
|
|
|
|
[[security-api-get-privileges-desc]]
|
|
|
|
==== {api-description-title}
|
2018-08-23 21:04:02 -04:00
|
|
|
|
|
|
|
To check a user's application privileges, use the
|
|
|
|
<<security-api-has-privileges,has privileges API>>.
|
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-privileges-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
2018-08-23 21:04:02 -04:00
|
|
|
|
|
|
|
`application`::
|
2019-08-02 13:56:05 -04:00
|
|
|
(Optional, string) The name of the application. Application privileges are
|
|
|
|
always associated with exactly one application. If you do not specify this
|
|
|
|
parameter, the API returns information about all privileges for all
|
|
|
|
applications.
|
2018-08-23 21:04:02 -04:00
|
|
|
|
|
|
|
`privilege`::
|
2019-08-02 13:56:05 -04:00
|
|
|
(Optional, string) The name of the privilege. If you do not specify this
|
|
|
|
parameter, the API returns information about all privileges for the requested
|
|
|
|
application.
|
2018-08-23 21:04:02 -04:00
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-privileges-example]]
|
|
|
|
==== {api-examples-title}
|
2018-08-23 21:04:02 -04:00
|
|
|
|
|
|
|
The following example retrieves information about the `read` privilege for the
|
|
|
|
`app01` application:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/privilege/myapp/read
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:app0102_privileges]
|
|
|
|
|
|
|
|
A successful call returns an object keyed by application name and privilege
|
|
|
|
name. If the privilege is not defined, the request responds with a 404 status.
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console-result]
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"myapp": {
|
|
|
|
"read": {
|
|
|
|
"application": "myapp",
|
|
|
|
"name": "read",
|
|
|
|
"actions": [
|
|
|
|
"data:read/*",
|
|
|
|
"action:login"
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"description": "Read access to myapp"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
To retrieve all privileges for an application, omit the privilege name:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/privilege/myapp/
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
To retrieve every privilege, omit both the application and privilege names:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/privilege/
|
2018-08-23 21:04:02 -04:00
|
|
|
--------------------------------------------------
|