diff --git a/server/src/main/java/org/opensearch/action/ActionRequest.java b/server/src/main/java/org/opensearch/action/ActionRequest.java index 2254472dd6801..7ab87065bef7e 100644 --- a/server/src/main/java/org/opensearch/action/ActionRequest.java +++ b/server/src/main/java/org/opensearch/action/ActionRequest.java @@ -35,7 +35,6 @@ import org.opensearch.common.annotation.PublicApi; import org.opensearch.core.common.io.stream.StreamInput; import org.opensearch.core.common.io.stream.StreamOutput; -import org.opensearch.identity.Subject; import org.opensearch.transport.TransportRequest; import java.io.IOException; @@ -48,8 +47,6 @@ @PublicApi(since = "1.0.0") public abstract class ActionRequest extends TransportRequest { - private Subject runAs; - public ActionRequest() { super(); // this does not set the listenerThreaded API, if needed, its up to the caller to set it @@ -70,14 +67,6 @@ public boolean getShouldStoreResult() { return false; } - public void runAs(Subject runAs) { - this.runAs = runAs; - } - - public Subject getRunAs() { - return this.runAs; - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/opensearch/client/support/AbstractClient.java b/server/src/main/java/org/opensearch/client/support/AbstractClient.java index f94e93e30fc46..509cd732357d6 100644 --- a/server/src/main/java/org/opensearch/client/support/AbstractClient.java +++ b/server/src/main/java/org/opensearch/client/support/AbstractClient.java @@ -422,7 +422,6 @@ import org.opensearch.core.common.bytes.BytesReference; import org.opensearch.core.tasks.TaskId; import org.opensearch.core.xcontent.MediaType; -import org.opensearch.identity.Subject; import org.opensearch.threadpool.ThreadPool; import java.util.Map; @@ -481,20 +480,7 @@ public final vo Request request, ActionListener listener ) { - Subject runAs = request.getRunAs(); - if (runAs != null) { - try { - runAs.runAs(() -> { - doExecute(action, request, listener); - return null; - }); - } catch (Exception e) { - throw new RuntimeException(e); - } - } else { - // run with default subject. If security is installed, default subject is the authenticated user - doExecute(action, request, listener); - } + doExecute(action, request, listener); } protected abstract void doExecute(