Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.identity;

import org.opensearch.common.settings.Settings;

import java.nio.file.Path;

public class IdentityService {

Settings settings;
Path extensionPath;

public IdentityService() {
this.settings = null;
this.extensionPath = Path.of("");
}

public IdentityService(Settings settings, Path extensionPath) {
this.settings = settings;
this.extensionPath = extensionPath;
}

public ServiceAccountManager getServiceAccountManager() {
ServiceAccountManager serviceAccountManager = new ServiceAccountManager(settings, extensionPath);
return serviceAccountManager;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.identity;

public class NoopIdentityService extends IdentityService{

public NoopIdentityService() {
super();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.identity;

import org.opensearch.common.settings.Settings;

import java.nio.file.Path;

public class ServiceAccountManager {

Settings settings;
Path extensionsPath;
public ServiceAccountManager(Settings settings, Path extensionsPath) {
this.settings = settings;
this.extensionsPath = extensionsPath;
}

public String getOrCreateServiceAccount(String extensionId) {
String authenticationString = "";
//TODO: Make this hook into the security plugin
return authenticationString;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import org.opensearch.env.ShardLockObtainFailedException;
import org.opensearch.gateway.MetaStateService;
import org.opensearch.gateway.MetadataStateFormat;
import org.opensearch.identity.IdentityService;
import org.opensearch.index.Index;
import org.opensearch.index.IndexModule;
import org.opensearch.index.IndexNotFoundException;
Expand Down Expand Up @@ -250,6 +251,7 @@ public class IndicesService extends AbstractLifecycleComponent
private final Settings settings;
private final PluginsService pluginsService;
private final ExtensionsManager extensionsManager;
private final IdentityService identityService;
private final NodeEnvironment nodeEnv;
private final NamedXContentRegistry xContentRegistry;
private final TimeValue shardsClosedTimeout;
Expand Down Expand Up @@ -325,6 +327,7 @@ public IndicesService(
this.threadPool = threadPool;
this.pluginsService = pluginsService;
this.extensionsManager = null;
this.identityService = null;
this.nodeEnv = nodeEnv;
this.xContentRegistry = xContentRegistry;
this.valuesSourceRegistry = valuesSourceRegistry;
Expand Down Expand Up @@ -415,6 +418,7 @@ public IndicesService(
Settings settings,
PluginsService pluginsService,
ExtensionsManager extensionsManager,
IdentityService identityService,
NodeEnvironment nodeEnv,
NamedXContentRegistry xContentRegistry,
AnalysisRegistry analysisRegistry,
Expand All @@ -440,6 +444,7 @@ public IndicesService(
this.threadPool = threadPool;
this.pluginsService = pluginsService;
this.extensionsManager = extensionsManager;
this.identityService = identityService;
this.nodeEnv = nodeEnv;
this.xContentRegistry = xContentRegistry;
this.valuesSourceRegistry = valuesSourceRegistry;
Expand Down
7 changes: 7 additions & 0 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.cluster.routing.allocation.AwarenessReplicaBalance;
import org.opensearch.identity.NoopIdentityService;
import org.opensearch.index.IndexModule;
import org.opensearch.index.IndexingPressureService;
import org.opensearch.indices.replication.SegmentReplicationSourceFactory;
Expand Down Expand Up @@ -134,6 +135,7 @@
import org.opensearch.gateway.MetaStateService;
import org.opensearch.gateway.PersistedClusterStateService;
import org.opensearch.http.HttpServerTransport;
import org.opensearch.identity.IdentityService;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.analysis.AnalysisRegistry;
import org.opensearch.index.engine.EngineFactory;
Expand Down Expand Up @@ -351,6 +353,7 @@ public static class DiscoverySettings {
private final NodeEnvironment nodeEnvironment;
private final PluginsService pluginsService;
private final ExtensionsManager extensionsManager;
private final IdentityService identityService;
private final NodeClient client;
private final Collection<LifecycleComponent> pluginLifecycleComponents;
private final LocalNodeFactory localNodeFactory;
Expand Down Expand Up @@ -443,8 +446,10 @@ protected Node(

if (FeatureFlags.isEnabled(FeatureFlags.EXTENSIONS)) {
this.extensionsManager = new ExtensionsManager(tmpSettings, initialEnvironment.extensionDir());
this.identityService = new IdentityService(tmpSettings, initialEnvironment.extensionDir());
} else {
this.extensionsManager = new NoopExtensionsManager();
this.identityService = new NoopIdentityService();
}

final Set<DiscoveryNodeRole> additionalRoles = pluginsService.filterPlugins(Plugin.class)
Expand Down Expand Up @@ -681,6 +686,7 @@ protected Node(
settings,
pluginsService,
extensionsManager,
identityService,
nodeEnvironment,
xContentRegistry,
analysisModule.getAnalysisRegistry(),
Expand Down Expand Up @@ -1019,6 +1025,7 @@ protected Node(
b.bind(NodeClient.class).toInstance(client);
b.bind(Environment.class).toInstance(this.environment);
b.bind(ExtensionsManager.class).toInstance(this.extensionsManager);
b.bind(IdentityService.class).toInstance(this.identityService);
b.bind(ThreadPool.class).toInstance(threadPool);
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);
b.bind(ResourceWatcherService.class).toInstance(resourceWatcherService);
Expand Down