2018-08-20 17:30:42 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[[security-api-get-role-mapping]]
|
|
|
|
=== Get role mappings API
|
2018-12-20 13:23:28 -05:00
|
|
|
++++
|
|
|
|
<titleabbrev>Get role mappings</titleabbrev>
|
|
|
|
++++
|
2018-08-20 17:30:42 -04:00
|
|
|
|
|
|
|
Retrieves role mappings.
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-role-mapping-request]]
|
|
|
|
==== {api-request-title}
|
2018-08-20 17:30:42 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/role_mapping` +
|
2018-08-20 17:30:42 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/role_mapping/<name>`
|
2018-08-20 17:30:42 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-role-mapping-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* To use this API, you must have at least the `manage_security` cluster privilege.
|
|
|
|
|
|
|
|
[[security-api-get-role-mapping-desc]]
|
|
|
|
==== {api-description-title}
|
2018-08-20 17:30:42 -04:00
|
|
|
|
|
|
|
Role mappings define which roles are assigned to each user. For more information,
|
|
|
|
see {stack-ov}/mapping-roles.html[Mapping users and groups to roles].
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-role-mapping-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
2018-08-20 17:30:42 -04:00
|
|
|
|
|
|
|
`name`::
|
2019-08-02 13:56:05 -04:00
|
|
|
(Optional, string) The distinct name that identifies the role mapping. The name
|
|
|
|
is used solely as an identifier to facilitate interaction via the API; it does
|
2018-08-20 17:30:42 -04:00
|
|
|
not affect the behavior of the mapping in any way. You can specify multiple
|
|
|
|
mapping names as a comma-separated list. If you do not specify this
|
|
|
|
parameter, the API returns information about all role mappings.
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-role-mapping-response-body]]
|
|
|
|
==== {api-response-body-title}
|
2018-08-20 17:30:42 -04:00
|
|
|
|
|
|
|
A successful call retrieves an object, where the keys are the
|
|
|
|
names of the request mappings, and the values are the JSON representation of
|
|
|
|
those mappings. For more information, see
|
|
|
|
<<role-mapping-resources>>.
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-role-mapping-response-codes]]
|
|
|
|
==== {api-response-codes-title}
|
|
|
|
|
2018-08-20 17:30:42 -04:00
|
|
|
If there is no mapping with the requested name, the
|
|
|
|
response will have status code `404`.
|
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-get-role-mapping-example]]
|
|
|
|
==== {api-examples-title}
|
2018-08-20 17:30:42 -04:00
|
|
|
|
|
|
|
The following example retrieves information about the `mapping1` role mapping:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2018-08-20 17:30:42 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/role_mapping/mapping1
|
2018-08-20 17:30:42 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:role_mapping]
|
|
|
|
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console-result]
|
2018-08-20 17:30:42 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"mapping1": {
|
|
|
|
"enabled": true,
|
|
|
|
"roles": [
|
|
|
|
"user"
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"field": {
|
|
|
|
"username": "*"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"metadata": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|