Skip to content

Commit 24efe6c

Browse files
Puts share API registration behind feature flag
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
1 parent a54fb20 commit 24efe6c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/org/opensearch/security/OpenSearchSecurityPlugin.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
import static org.opensearch.security.resources.ResourceSharingIndexHandler.getSharingIndex;
241241
import static org.opensearch.security.setting.DeprecatedSettings.checkForDeprecatedSetting;
242242
import static org.opensearch.security.support.ConfigConstants.OPENDISTRO_SECURITY_AUTHENTICATED_USER;
243+
import static org.opensearch.security.support.ConfigConstants.OPENSEARCH_RESOURCE_SHARING_ENABLED_DEFAULT;
243244
import static org.opensearch.security.support.ConfigConstants.SECURITY_ALLOW_DEFAULT_INIT_SECURITYINDEX;
244245
import static org.opensearch.security.support.ConfigConstants.SECURITY_ALLOW_DEFAULT_INIT_USE_CLUSTER_STATE;
245246
import static org.opensearch.security.support.ConfigConstants.SECURITY_SSL_CERTIFICATES_HOT_RELOAD_ENABLED;
@@ -691,7 +692,9 @@ public List<RestHandler> getRestHandlers(
691692
);
692693

693694
// Resource sharing API to update sharing info
694-
handlers.add(new ShareRestAction());
695+
if (settings.getAsBoolean(ConfigConstants.OPENSEARCH_RESOURCE_SHARING_ENABLED, OPENSEARCH_RESOURCE_SHARING_ENABLED_DEFAULT)) {
696+
handlers.add(new ShareRestAction());
697+
}
695698

696699
}
697700
log.debug("Added {} rest handler(s)", handlers.size());
@@ -722,7 +725,10 @@ public UnaryOperator<RestHandler> getRestHandlerWrapper(final ThreadContext thre
722725
actions.add(new ActionHandler<>(WhoAmIAction.INSTANCE, TransportWhoAmIAction.class));
723726

724727
// transport action to handle sharing info update
725-
actions.add(new ActionHandler<>(ShareAction.INSTANCE, ShareTransportAction.class));
728+
if (settings.getAsBoolean(ConfigConstants.OPENSEARCH_RESOURCE_SHARING_ENABLED, OPENSEARCH_RESOURCE_SHARING_ENABLED_DEFAULT)) {
729+
actions.add(new ActionHandler<>(ShareAction.INSTANCE, ShareTransportAction.class));
730+
}
731+
726732
}
727733
return actions;
728734
}

0 commit comments

Comments
 (0)