-
Notifications
You must be signed in to change notification settings - Fork 56
Onboards flow-framework plugin to resource-sharing and access control framework #1251
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
base: main
Are you sure you want to change the base?
Onboards flow-framework plugin to resource-sharing and access control framework #1251
Conversation
… framework Signed-off-by: Darshit Chanpura <[email protected]>
CI will resolve once: opensearch-project/security#5677 is merged. |
Signed-off-by: Darshit Chanpura <[email protected]>
…e-sharing tests Signed-off-by: Darshit Chanpura <[email protected]>
8f62909
to
6937e06
Compare
Signed-off-by: Darshit Chanpura <[email protected]>
dace39b
to
69009e6
Compare
CI blocked by #1252 |
Signed-off-by: Darshit Chanpura <[email protected]>
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.
1st iteration
|
||
dependencies { | ||
// For resource access control | ||
compileOnly group: 'org.opensearch', name:'opensearch-security-spi', version:"3.4.0-SNAPSHOT" |
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.
Can we fetch the version from the variable?
testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}") | ||
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson_databind}") | ||
|
||
testImplementation 'org.awaitility:awaitility:4.3.0' |
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.
Constant for the version
// | Output for ./bin/opensearch-plugin:ERROR: transport error 202: connect failed: Connection refused | ||
// | ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) | ||
// | JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:700]. | ||
// So instead, we listen to a debugger by saying server=y and suspend=n |
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.
Can we remove the comments?
* @return true if resource-authz should be used, false otherwise | ||
*/ | ||
public static boolean shouldUseResourceAuthz(String resourceType) { | ||
var client = ResourceSharingClientAccessor.getInstance().getResourceSharingClient(); |
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.
Can we make it explicit
var client = ResourceSharingClientAccessor.getInstance().getResourceSharingClient(); | |
ResourceSharingClient client = ResourceSharingClientAccessor.getInstance().getResourceSharingClient(); |
* @param onSuccess consumer function to execute if resource sharing feature is enabled | ||
* @param fallbackOn501 consumer function to execute if resource sharing feature is disabled. | ||
*/ | ||
public static void verifyResourceAccessAndProcessRequest(String resourceType, Runnable onSuccess, Runnable fallbackOn501) { |
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.
public static void verifyResourceAccessAndProcessRequest(String resourceType, Runnable onSuccess, Runnable fallbackOn501) { | |
public static void verifyResourceAccessAndProcessRequest(String resourceType, Runnable onSuccess, Runnable onFailure) { |
|
||
private Subject subject; | ||
|
||
public PluginClient(Client delegate) { |
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.
public PluginClient(Client delegate) { | |
public PluginClient(Client client) { |
super(delegate); | ||
} | ||
|
||
public PluginClient(Client delegate, Subject subject) { |
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.
public PluginClient(Client delegate, Subject subject) { | |
public PluginClient(Client client, Subject subject) { |
super(delegate); | ||
} | ||
|
||
public PluginClient(Client delegate, Subject subject) { |
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.
Where this constructor used?
Request request, | ||
ActionListener<Response> listener | ||
) { | ||
if (subject == null) { |
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.
subject would be null with the first constructor call, right?
* Accessor for resource sharing client | ||
*/ | ||
public class ResourceSharingClientAccessor { | ||
private ResourceSharingClient CLIENT; |
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.
Can make it as thread safe?
private ResourceSharingClient CLIENT; | |
private final AtomicReference<ResourceSharingClient> client = new AtomicReference<>(); |
Description
Implements resource-access-control for workflow and workflow_state.
Related Issues
Check List
--signoff
.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.