Skip to content

Commit

Permalink
Ready for pull requeest feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Jan 27, 2023
1 parent 16bf848 commit b2162a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,12 @@ protected Node(
// Ensure to initialize Feature Flags via the settings from opensearch.yml
FeatureFlags.initializeFeatureFlags(settings);

final IdentityService identityService = new IdentityService(settings, pluginsService.filterPlugins(IdentityPlugin.class));
final List<IdentityPlugin> identityPlugins = new ArrayList<>();
if (FeatureFlags.isEnabled(FeatureFlags.IDENTITY)) {
// If identity is enabled load plugins implementing the extension point
identityPlugins.addAll(pluginsService.filterPlugins(IdentityPlugin.class));
}
final IdentityService identityService = new IdentityService(settings, identityPlugins);

final Set<DiscoveryNodeRole> additionalRoles = pluginsService.filterPlugins(Plugin.class)
.stream()
Expand Down
5 changes: 5 additions & 0 deletions server/src/main/java/org/opensearch/rest/RestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.common.path.PathTrie;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.internal.io.Streams;
Expand Down Expand Up @@ -521,6 +522,10 @@ private void handleBadRequest(String uri, RestRequest.Method method, RestChannel
* @returns false if there was an error and the request should not continue being dispatched
* */
private boolean handleAuthenticateUser(final RestRequest request, final RestChannel channel) {
if (!FeatureFlags.isEnabled(FeatureFlags.IDENTITY)) {
return true;
}

try {
final AuthToken token = RestTokenExtractor.extractToken(request);
// If no token was found, continue executing the request
Expand Down

0 comments on commit b2162a7

Please sign in to comment.