Use auth tokens passed from core and introduce extension and user REST clients#892
Draft
cwperks wants to merge 8 commits intoopensearch-project:mainfrom
Draft
Use auth tokens passed from core and introduce extension and user REST clients#892cwperks wants to merge 8 commits intoopensearch-project:mainfrom
cwperks wants to merge 8 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
…T clients Signed-off-by: Craig Perkins <cwperx@amazon.com>
4 tasks
peternied
reviewed
Aug 16, 2023
Member
peternied
left a comment
There was a problem hiding this comment.
Took a quick look - thanks for getting this setup, seems decent to me. Maybe there are a couple of things that could be cleaned up by influencing https://github.com/opensearch-project/OpenSearch/pull/8526/files
| ); | ||
| } | ||
|
|
||
| String oboToken = request.getRequestIssuerIdentity(); |
Member
There was a problem hiding this comment.
Seems like this should be called an onBehalfOfToken both here and on the request object?
What do you think about making the type Optional<> ?
Member
Author
There was a problem hiding this comment.
Agreed. I think this needs to be updated in core. I can create a PR for that.
35 tasks
Signed-off-by: Craig Perkins <cwperx@amazon.com>
4 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Companion example PR for integ testing in security: cwperks/security#6
Companion example PR for integ testing in core: cwperks/OpenSearch#94
This PR introduces an
extensionRestClientanduserRestClientthat an extension developer can utilize to make REST Requests with Auth Tokens back to an OpenSearch Cluster.The
extensionRestClientis part of theextensionsRunnerand is available extension-wide. This REST Client uses a Service Account Token to make requests to an OpenSearch cluster on an extension's own behalf. A common example of an extension making requests to OpenSearch on its own behalf is when interacting with a system index that the extension has reserved.The
userRestClientis instantiated inhandleRequestofBaseExtensionRestHandlerand is available to use in all extension REST Handlers. This REST client is utilized to make requests back to opensearch on behalf of the original authenticated user utilizing an On-Behalf-Of token. The On-Behalf-Of token is a short lived access token (JWT) that includes an audience claim that is populated with the destination extension's unique ID. The On-Behalf-Of token lets an extension act as the original user. @peternied is also working on mechanisms for cluster admins to impose further restrictions on these tokens. Details can be found hereThe last thing this PR introduces is another security setting to be placed in the extension's settings file:
ssl.http.enabledThis setting is used to determine the scheme (
httporhttps) of the REST Client. This is a boolean setting.Issues Resolved
#887
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.