加载中

角色限制

角色限制可用于指定角色生效的条件。当条件不满足时,角色将被禁用,从而导致访问被拒绝。不指定限制意味着角色不受限制,因此始终有效。这是默认行为。

目前,角色限制仅支持 API 密钥,但有一个限制:API 密钥只能拥有一个角色描述符。

工作流允许将角色限制为仅在调用特定的 REST API 时生效。调用工作流不允许的 REST API 将导致角色被禁用。以下章节列出了您可以将角色限制到的工作流。

search_application_query
此工作流将角色限制为仅限 搜索应用程序搜索 API
注意

工作流名称区分大小写。

以下示例创建了一个带有 search_application_query 工作流限制的 API 密钥,该密钥允许仅调用 搜索应用程序搜索 API

				POST /_security/api_key
					{
  "name": "my-restricted-api-key",
  "role_descriptors": {
    "my-restricted-role-descriptor": {
      "indices": [
        {
          "names": ["my-search-app"],
          "privileges": ["read"]
        }
      ],
      "restriction":  {
        "workflows": ["search_application_query"]
      }
    }
  }
}
		
© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.