-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Create ScheduledJobIdentityManager interface in IdentityPlugin #7573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ScheduledJobIdentityManager interface in IdentityPlugin #7573
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
| * @param jobId The id of the scheduled job | ||
| * @param indexName The index where scheduled job details is stored | ||
| */ | ||
| void saveUserDetails(String jobId, String indexName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by User here? Are you talking about the user who's credentials are being used for authz or are you talking about the plugin/extension subject performing the job? Are you parsing the user from the threadContext or is it supposed to be associated with the job in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be left up to an IdentityPlugin to implement, but the idea with the security plugin is that this user is the creator of the scheduled job. For the security plugin that does mean getting the authenticated user from the threadcontext and persisting it in an index that would contain all scheduled jobs and the user (owner) associated with them.
See opensearch-project/security#2773 for an implementation in the Security plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scrawfor99 This PR has been updated to include a ScheduledJobIdentity which is generic and contains a username and a map of attributes.
| * @param jobId The id of the scheduled job | ||
| * @param indexName The index where scheduled job details is stored | ||
| */ | ||
| void deleteUserDetails(String jobId, String indexName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this is required or do you think we can just wipe the details after job resolution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be if a user deletes a scheduled job altogether. If the original job details is purged from the index that stores the job details then this hook provides a way for an IdentityPlugin to hook into that and react accordingly - for the Security plugin that would mean deleting the entry from the index containing all scheduled jobs and associated user.
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
|
Closing for now. Will re-open at a later date with updates. |
Description
Companion PR in security repo: opensearch-project/security#2773
Companion PR in Job Scheduler: opensearch-project/job-scheduler#394
This PR introduces a new interface inside identity plugin for scheduled job identity management. The new interface is called
ScheduledJobIdentityManagerand contains 3 methods that Job Scheduler will use for extensions use-cases where scheduled jobs run out of process. The current architecture of plugins that extend job scheduler plugin and manage job details in an index owned by the respective plugin (not owned by job scheduler, but made aware to job scheduler) can be changed using this new model.While the interface is being created here and can be implemented differently, the implementation inside the security plugin being proposed will keep a list of all registered jobs in a single index owned by the security plugin and owner information will be stored in this index. There would be a 1-to-1 mapping of job details stored across all job details indices of plugins that extend job scheduler and this full list owned by the security plugin with owner information. For referential integrity it is stored with the
jobIdandjobIndexwhich is the compound key that links back to the document containing jobs details.With the user information persisted on a secure index, the implementer of this interface can implement another method
issueAccessTokenOnBehalfOfUserto issue an access token to be sent to a job runner to be able to execute a job under a user context outside of the user being present.Related Issues
Resolves opensearch-project/security#2626
Check List
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.