-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support updates of API key attributes [REST and transport layer] (#88186
) REST and transport layer implementation to add support for updating attributes of existing API keys. This allows end-users to modify privileges and metadata associated with API keys dynamically, without requiring rolling out new API keys every time there is a change. The new route supports updates to one API key, given its ID: PUT /_security/api_key/{id} The request body consists of optional fields role_descriptors and metadata. If a request field is absent, the existing value of the field on the given API key is retained. If a request field is set to {} it replaces the existing value with {}. Explicit null-values for request fields are not allowed and will produce a 400. limited_by_role_descriptors, creator, and version are automatically updated on every call. Attributes a replaced, not merged. Only the owner user of an API key can update it. API keys cannot update themselves, nor can other users (even users with all or manage_security cluster privileges). Relates: #87870
- Loading branch information
Showing
17 changed files
with
759 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 88186 | ||
summary: Support updates of API key attributes (single operation route) | ||
area: Authentication | ||
type: feature | ||
issues: [] |
20 changes: 20 additions & 0 deletions
20
...src/main/java/org/elasticsearch/xpack/core/security/action/apikey/UpdateApiKeyAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.security.action.apikey; | ||
|
||
import org.elasticsearch.action.ActionType; | ||
|
||
public final class UpdateApiKeyAction extends ActionType<UpdateApiKeyResponse> { | ||
|
||
public static final String NAME = "cluster:admin/xpack/security/api_key/update"; | ||
public static final UpdateApiKeyAction INSTANCE = new UpdateApiKeyAction(); | ||
|
||
private UpdateApiKeyAction() { | ||
super(NAME, UpdateApiKeyResponse::new); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.