diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicAuthClassCompositionConfig.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicAuthClassCompositionConfig.java new file mode 100644 index 000000000000..533dabc7dda7 --- /dev/null +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicAuthClassCompositionConfig.java @@ -0,0 +1,128 @@ +/* + * Licensed to Metamarkets Group Inc. (Metamarkets) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Metamarkets licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.druid.security.basic; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Basic authentication storage/cache/resource handler config. + * BasicAuthClassCompositionConfig provides options to specify authenticator/authorizer classes of user/role managers, + * caches and notifiers. If a field in this class is non-null then the corresponding class is instantiated + * regardless of what type of Druid component runs it (see {@link BasicSecurityDruidModule}). + * Hence every Druid component might be a user/role manager and notify others by sending notifications. + * Every field must be a valid class name (appropriate for the corresponding goal) or null. + */ +public class BasicAuthClassCompositionConfig +{ + @JsonProperty + private final String authenticatorMetadataStorageUpdater; + + @JsonProperty + private final String authenticatorCacheManager; + + @JsonProperty + private final String authenticatorResourceHandler; + + @JsonProperty + private final String authenticatorCacheNotifier; + + @JsonProperty + private final String authorizerMetadataStorageUpdater; + + @JsonProperty + private final String authorizerCacheManager; + + @JsonProperty + private final String authorizerResourceHandler; + + @JsonProperty + private final String authorizerCacheNotifier; + + @JsonCreator + public BasicAuthClassCompositionConfig( + @JsonProperty("authenticatorMetadataStorageUpdater") String authenticatorMetadataStorageUpdater, + @JsonProperty("authenticatorCacheManager") String authenticatorCacheManager, + @JsonProperty("authenticatorResourceHandler") String authenticatorResourceHandler, + @JsonProperty("authenticatorCacheNotifier") String authenticatorCacheNotifier, + @JsonProperty("authorizerMetadataStorageUpdater") String authorizerMetadataStorageUpdater, + @JsonProperty("authorizerCacheManager") String authorizerCacheManager, + @JsonProperty("authorizerResourceHandler") String authorizerResourceHandler, + @JsonProperty("authorizerCacheNotifier") String authorizerCacheNotifier + ) + { + this.authenticatorMetadataStorageUpdater = authenticatorMetadataStorageUpdater; + this.authenticatorCacheManager = authenticatorCacheManager; + this.authenticatorResourceHandler = authenticatorResourceHandler; + this.authenticatorCacheNotifier = authenticatorCacheNotifier; + this.authorizerMetadataStorageUpdater = authorizerMetadataStorageUpdater; + this.authorizerCacheManager = authorizerCacheManager; + this.authorizerResourceHandler = authorizerResourceHandler; + this.authorizerCacheNotifier = authorizerCacheNotifier; + } + + @JsonProperty + public String getAuthenticatorMetadataStorageUpdater() + { + return authenticatorMetadataStorageUpdater; + } + + @JsonProperty + public String getAuthenticatorCacheManager() + { + return authenticatorCacheManager; + } + + @JsonProperty + public String getAuthenticatorResourceHandler() + { + return authenticatorResourceHandler; + } + + @JsonProperty + public String getAuthenticatorCacheNotifier() + { + return authenticatorCacheNotifier; + } + + @JsonProperty + public String getAuthorizerMetadataStorageUpdater() + { + return authorizerMetadataStorageUpdater; + } + + @JsonProperty + public String getAuthorizerCacheManager() + { + return authorizerCacheManager; + } + + @JsonProperty + public String getAuthorizerResourceHandler() + { + return authorizerResourceHandler; + } + + @JsonProperty + public String getAuthorizerCacheNotifier() + { + return authorizerCacheNotifier; + } +} diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicSecurityDruidModule.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicSecurityDruidModule.java index 8e14d8770bee..a65e09487230 100644 --- a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicSecurityDruidModule.java +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/BasicSecurityDruidModule.java @@ -39,8 +39,10 @@ import io.druid.security.basic.authentication.db.cache.CoordinatorBasicAuthenticatorCacheNotifier; import io.druid.security.basic.authentication.db.cache.CoordinatorPollingBasicAuthenticatorCacheManager; import io.druid.security.basic.authentication.db.cache.MetadataStoragePollingBasicAuthenticatorCacheManager; +import io.druid.security.basic.authentication.db.cache.NoopBasicAuthenticatorCacheNotifier; import io.druid.security.basic.authentication.db.updater.BasicAuthenticatorMetadataStorageUpdater; import io.druid.security.basic.authentication.db.updater.CoordinatorBasicAuthenticatorMetadataStorageUpdater; +import io.druid.security.basic.authentication.db.updater.NoopBasicAuthenticatorMetadataStorageUpdater; import io.druid.security.basic.authentication.endpoint.BasicAuthenticatorResource; import io.druid.security.basic.authentication.endpoint.BasicAuthenticatorResourceHandler; import io.druid.security.basic.authentication.endpoint.CoordinatorBasicAuthenticatorResourceHandler; @@ -51,8 +53,10 @@ import io.druid.security.basic.authorization.db.cache.CoordinatorBasicAuthorizerCacheNotifier; import io.druid.security.basic.authorization.db.cache.CoordinatorPollingBasicAuthorizerCacheManager; import io.druid.security.basic.authorization.db.cache.MetadataStoragePollingBasicAuthorizerCacheManager; +import io.druid.security.basic.authorization.db.cache.NoopBasicAuthorizerCacheNotifier; import io.druid.security.basic.authorization.db.updater.BasicAuthorizerMetadataStorageUpdater; import io.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater; +import io.druid.security.basic.authorization.db.updater.NoopBasicAuthorizerMetadataStorageUpdater; import io.druid.security.basic.authorization.endpoint.BasicAuthorizerResource; import io.druid.security.basic.authorization.endpoint.BasicAuthorizerResourceHandler; import io.druid.security.basic.authorization.endpoint.CoordinatorBasicAuthorizerResourceHandler; @@ -62,10 +66,12 @@ public class BasicSecurityDruidModule implements DruidModule { + @Override public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.auth.basic.common", BasicAuthCommonCacheConfig.class); + JsonConfigProvider.bind(binder, "druid.auth.basic.composition", BasicAuthClassCompositionConfig.class); LifecycleModule.register(binder, BasicAuthenticatorMetadataStorageUpdater.class); LifecycleModule.register(binder, BasicAuthorizerMetadataStorageUpdater.class); @@ -76,84 +82,124 @@ public void configure(Binder binder) Jerseys.addResource(binder, BasicAuthorizerResource.class); } - @Provides @LazySingleton - public static BasicAuthenticatorMetadataStorageUpdater createAuthenticatorStorageUpdater(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthenticatorMetadataStorageUpdater createAuthenticatorStorageUpdater( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(CoordinatorBasicAuthenticatorMetadataStorageUpdater.class); - } else { - return null; - } + return getInstance( + injector, + config.getAuthenticatorMetadataStorageUpdater(), + CoordinatorBasicAuthenticatorMetadataStorageUpdater.class, + NoopBasicAuthenticatorMetadataStorageUpdater.class + ); } - @Provides @LazySingleton - public static BasicAuthenticatorCacheManager createAuthenticatorCacheManager(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthenticatorCacheManager createAuthenticatorCacheManager( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(MetadataStoragePollingBasicAuthenticatorCacheManager.class); - } else { - return injector.getInstance(CoordinatorPollingBasicAuthenticatorCacheManager.class); - } + return getInstance( + injector, + config.getAuthenticatorCacheManager(), + MetadataStoragePollingBasicAuthenticatorCacheManager.class, + CoordinatorPollingBasicAuthenticatorCacheManager.class + ); } - @Provides @LazySingleton - public static BasicAuthenticatorResourceHandler createAuthenticatorResourceHandler(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthenticatorResourceHandler createAuthenticatorResourceHandler( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(CoordinatorBasicAuthenticatorResourceHandler.class); - } else { - return injector.getInstance(DefaultBasicAuthenticatorResourceHandler.class); - } + return getInstance( + injector, + config.getAuthenticatorResourceHandler(), + CoordinatorBasicAuthenticatorResourceHandler.class, + DefaultBasicAuthenticatorResourceHandler.class + ); } - @Provides @LazySingleton - public static BasicAuthenticatorCacheNotifier createAuthenticatorCacheNotifier(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthenticatorCacheNotifier createAuthenticatorCacheNotifier( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(CoordinatorBasicAuthenticatorCacheNotifier.class); - } else { - return null; - } + return getInstance( + injector, + config.getAuthenticatorCacheNotifier(), + CoordinatorBasicAuthenticatorCacheNotifier.class, + NoopBasicAuthenticatorCacheNotifier.class + ); } - @Provides @LazySingleton - public static BasicAuthorizerMetadataStorageUpdater createAuthorizerStorageUpdater(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthorizerMetadataStorageUpdater createAuthorizerStorageUpdater( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(CoordinatorBasicAuthorizerMetadataStorageUpdater.class); - } else { - return null; - } + return getInstance( + injector, + config.getAuthorizerMetadataStorageUpdater(), + CoordinatorBasicAuthorizerMetadataStorageUpdater.class, + NoopBasicAuthorizerMetadataStorageUpdater.class + ); } - @Provides @LazySingleton - public static BasicAuthorizerCacheManager createAuthorizerCacheManager(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthorizerCacheManager createAuthorizerCacheManager( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(MetadataStoragePollingBasicAuthorizerCacheManager.class); - } else { - return injector.getInstance(CoordinatorPollingBasicAuthorizerCacheManager.class); - } + return getInstance( + injector, + config.getAuthorizerCacheManager(), + MetadataStoragePollingBasicAuthorizerCacheManager.class, + CoordinatorPollingBasicAuthorizerCacheManager.class + ); } - @Provides @LazySingleton - public static BasicAuthorizerResourceHandler createAuthorizerResourceHandler(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthorizerResourceHandler createAuthorizerResourceHandler( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(CoordinatorBasicAuthorizerResourceHandler.class); - } else { - return injector.getInstance(DefaultBasicAuthorizerResourceHandler.class); - } + return getInstance( + injector, + config.getAuthorizerResourceHandler(), + CoordinatorBasicAuthorizerResourceHandler.class, + DefaultBasicAuthorizerResourceHandler.class + ); } - @Provides @LazySingleton - public static BasicAuthorizerCacheNotifier createAuthorizerCacheNotifier(final Injector injector) + @Provides + @LazySingleton + public static BasicAuthorizerCacheNotifier createAuthorizerCacheNotifier( + final Injector injector, + BasicAuthClassCompositionConfig config + ) throws ClassNotFoundException { - if (isCoordinator(injector)) { - return injector.getInstance(CoordinatorBasicAuthorizerCacheNotifier.class); - } else { - return null; - } + return getInstance( + injector, + config.getAuthorizerCacheNotifier(), + CoordinatorBasicAuthorizerCacheNotifier.class, + NoopBasicAuthorizerCacheNotifier.class + ); } @Override @@ -168,6 +214,29 @@ public List getJacksonModules() ); } + /** + * Returns the instance provided either by a config property or coordinator-run class or default class. + * The order of check corresponds to the order of method params. + */ + private static T getInstance( + Injector injector, + String configClassName, + Class classRunByCoordinator, + Class defaultClass + ) throws ClassNotFoundException + { + if (configClassName != null) { + // ClassCastException is thrown in case of a mismatch, configuration fix is required. + @SuppressWarnings("unchecked") + final T instance = (T) injector.getInstance(Class.forName(configClassName)); + return instance; + } + if (isCoordinator(injector)) { + return injector.getInstance(classRunByCoordinator); + } + return injector.getInstance(defaultClass); + } + private static boolean isCoordinator(Injector injector) { final String serviceName; diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/NoopBasicAuthenticatorCacheNotifier.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/NoopBasicAuthenticatorCacheNotifier.java similarity index 77% rename from extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/NoopBasicAuthenticatorCacheNotifier.java rename to extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/NoopBasicAuthenticatorCacheNotifier.java index 22809cc8d4c6..647af43ccf7b 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/NoopBasicAuthenticatorCacheNotifier.java +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/cache/NoopBasicAuthenticatorCacheNotifier.java @@ -17,15 +17,18 @@ * under the License. */ -package io.druid.security.authentication; - -import io.druid.security.basic.authentication.db.cache.BasicAuthenticatorCacheNotifier; +package io.druid.security.basic.authentication.db.cache; +/** + * Noop basic authenticator cache notifier. + * No notification is sent on user udpate. + * Might be used as a config option to override default authenticator cache notifier. + */ public class NoopBasicAuthenticatorCacheNotifier implements BasicAuthenticatorCacheNotifier { @Override public void addUpdate(String updatedAuthenticatorPrefix, byte[] updatedUserMap) { - + // Do nothing as this is a noop implementation } } diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/updater/NoopBasicAuthenticatorMetadataStorageUpdater.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/updater/NoopBasicAuthenticatorMetadataStorageUpdater.java new file mode 100644 index 000000000000..da96cff7b200 --- /dev/null +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authentication/db/updater/NoopBasicAuthenticatorMetadataStorageUpdater.java @@ -0,0 +1,73 @@ +/* + * Licensed to Metamarkets Group Inc. (Metamarkets) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Metamarkets licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.druid.security.basic.authentication.db.updater; + +import io.druid.security.basic.authentication.entity.BasicAuthenticatorCredentialUpdate; +import io.druid.security.basic.authentication.entity.BasicAuthenticatorUser; + +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.Map; + +/** + * Empty implementation of {@link BasicAuthenticatorMetadataStorageUpdater}. + * Void methods do nothing, other return empty maps or empty arrays depending on the return type. + */ +public class NoopBasicAuthenticatorMetadataStorageUpdater implements BasicAuthenticatorMetadataStorageUpdater +{ + @Override + public void createUser(String prefix, String userName) + { + } + + @Override + public void deleteUser(String prefix, String userName) + { + } + + @Override + public void setUserCredentials(String prefix, String userName, BasicAuthenticatorCredentialUpdate update) + { + } + + @Nullable + @Override + public Map getCachedUserMap(String prefix) + { + return Collections.emptyMap(); + } + + @Override + public byte[] getCachedSerializedUserMap(String prefix) + { + return new byte[0]; + } + + @Override + public byte[] getCurrentUserMapBytes(String prefix) + { + return new byte[0]; + } + + @Override + public void refreshAllNotification() + { + } +} diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/NoopBasicAuthorizerCacheNotifier.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/NoopBasicAuthorizerCacheNotifier.java similarity index 77% rename from extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/NoopBasicAuthorizerCacheNotifier.java rename to extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/NoopBasicAuthorizerCacheNotifier.java index ca37a214c820..461dff2dc8f0 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/NoopBasicAuthorizerCacheNotifier.java +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/cache/NoopBasicAuthorizerCacheNotifier.java @@ -17,15 +17,18 @@ * under the License. */ -package io.druid.security.authorization; - -import io.druid.security.basic.authorization.db.cache.BasicAuthorizerCacheNotifier; +package io.druid.security.basic.authorization.db.cache; +/** + * Noop basic authorizer cache notifier. + * No notification is sent on user/role udpate. + * Might be used as a config option to override default authorizer cache notifier. + */ public class NoopBasicAuthorizerCacheNotifier implements BasicAuthorizerCacheNotifier { @Override public void addUpdate(String authorizerPrefix, byte[] userAndRoleMap) { - + // Do nothing as this is a noop implementation } } diff --git a/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/updater/NoopBasicAuthorizerMetadataStorageUpdater.java b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/updater/NoopBasicAuthorizerMetadataStorageUpdater.java new file mode 100644 index 000000000000..cbc41c791ef6 --- /dev/null +++ b/extensions-core/druid-basic-security/src/main/java/io/druid/security/basic/authorization/db/updater/NoopBasicAuthorizerMetadataStorageUpdater.java @@ -0,0 +1,99 @@ +/* + * Licensed to Metamarkets Group Inc. (Metamarkets) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Metamarkets licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.druid.security.basic.authorization.db.updater; + +import io.druid.security.basic.authorization.entity.BasicAuthorizerRole; +import io.druid.security.basic.authorization.entity.BasicAuthorizerUser; +import io.druid.server.security.ResourceAction; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Empty implementation of {@link BasicAuthorizerMetadataStorageUpdater}. + * Void methods do nothing, other return empty maps or empty arrays depending on the return type. + */ +public class NoopBasicAuthorizerMetadataStorageUpdater implements BasicAuthorizerMetadataStorageUpdater +{ + @Override + public void createUser(String prefix, String userName) + { + } + + @Override + public void deleteUser(String prefix, String userName) + { + } + + @Override + public void createRole(String prefix, String roleName) + { + } + + @Override + public void deleteRole(String prefix, String roleName) + { + } + + @Override + public void assignRole(String prefix, String userName, String roleName) + { + } + + @Override + public void unassignRole(String prefix, String userName, String roleName) + { + } + + @Override + public void setPermissions(String prefix, String roleName, List permissions) + { + } + + @Override + public Map getCachedUserMap(String prefix) + { + return Collections.emptyMap(); + } + + @Override + public Map getCachedRoleMap(String prefix) + { + return Collections.emptyMap(); + } + + @Override + public byte[] getCurrentUserMapBytes(String prefix) + { + return new byte[0]; + } + + @Override + public byte[] getCurrentRoleMapBytes(String prefix) + { + return new byte[0]; + } + + @Override + public void refreshAllNotification() + { + } +} diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorMetadataStorageUpdaterTest.java b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorMetadataStorageUpdaterTest.java index 3ea3b11847d6..c4d7978f035c 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorMetadataStorageUpdaterTest.java +++ b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorMetadataStorageUpdaterTest.java @@ -38,6 +38,7 @@ import io.druid.security.basic.BasicSecurityDBResourceException; import io.druid.security.basic.authentication.BasicHTTPAuthenticator; import io.druid.security.basic.authentication.BasicHTTPEscalator; +import io.druid.security.basic.authentication.db.cache.NoopBasicAuthenticatorCacheNotifier; import io.druid.security.basic.authentication.db.updater.CoordinatorBasicAuthenticatorMetadataStorageUpdater; import io.druid.security.basic.authentication.entity.BasicAuthenticatorCredentialUpdate; import io.druid.security.basic.authentication.entity.BasicAuthenticatorCredentials; diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorResourceTest.java b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorResourceTest.java index 3ab2a3855b07..59eb39787c1c 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorResourceTest.java +++ b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authentication/CoordinatorBasicAuthenticatorResourceTest.java @@ -39,6 +39,7 @@ import io.druid.security.basic.BasicAuthUtils; import io.druid.security.basic.authentication.BasicHTTPAuthenticator; import io.druid.security.basic.authentication.BasicHTTPEscalator; +import io.druid.security.basic.authentication.db.cache.NoopBasicAuthenticatorCacheNotifier; import io.druid.security.basic.authentication.db.updater.CoordinatorBasicAuthenticatorMetadataStorageUpdater; import io.druid.security.basic.authentication.endpoint.BasicAuthenticatorResource; import io.druid.security.basic.authentication.endpoint.CoordinatorBasicAuthenticatorResourceHandler; diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/BasicRoleBasedAuthorizerTest.java b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/BasicRoleBasedAuthorizerTest.java index aafac305525a..e9238fa978eb 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/BasicRoleBasedAuthorizerTest.java +++ b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/BasicRoleBasedAuthorizerTest.java @@ -28,6 +28,7 @@ import io.druid.security.basic.BasicAuthCommonCacheConfig; import io.druid.security.basic.authorization.BasicRoleBasedAuthorizer; import io.druid.security.basic.authorization.db.cache.MetadataStoragePollingBasicAuthorizerCacheManager; +import io.druid.security.basic.authorization.db.cache.NoopBasicAuthorizerCacheNotifier; import io.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater; import io.druid.server.security.Access; import io.druid.server.security.Action; diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerMetadataStorageUpdaterTest.java b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerMetadataStorageUpdaterTest.java index d1f6b1fb17ea..2091521bc302 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerMetadataStorageUpdaterTest.java +++ b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerMetadataStorageUpdaterTest.java @@ -31,6 +31,7 @@ import io.druid.security.basic.BasicAuthUtils; import io.druid.security.basic.BasicSecurityDBResourceException; import io.druid.security.basic.authorization.BasicRoleBasedAuthorizer; +import io.druid.security.basic.authorization.db.cache.NoopBasicAuthorizerCacheNotifier; import io.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater; import io.druid.security.basic.authorization.entity.BasicAuthorizerPermission; import io.druid.security.basic.authorization.entity.BasicAuthorizerRole; diff --git a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerResourceTest.java b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerResourceTest.java index 763b1f7d5f94..609bbf050b02 100644 --- a/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerResourceTest.java +++ b/extensions-core/druid-basic-security/src/test/java/io/druid/security/authorization/CoordinatorBasicAuthorizerResourceTest.java @@ -30,6 +30,7 @@ import io.druid.security.basic.BasicAuthCommonCacheConfig; import io.druid.security.basic.BasicAuthUtils; import io.druid.security.basic.authorization.BasicRoleBasedAuthorizer; +import io.druid.security.basic.authorization.db.cache.NoopBasicAuthorizerCacheNotifier; import io.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater; import io.druid.security.basic.authorization.endpoint.BasicAuthorizerResource; import io.druid.security.basic.authorization.endpoint.CoordinatorBasicAuthorizerResourceHandler; diff --git a/integration-tests/docker/historical.conf b/integration-tests/docker/historical.conf index 58cbd84e2416..2b507e299388 100644 --- a/integration-tests/docker/historical.conf +++ b/integration-tests/docker/historical.conf @@ -12,8 +12,8 @@ command=java -Dfile.encoding=UTF-8 -Ddruid.host=%(ENV_HOST_IP)s -Ddruid.zk.service.host=druid-zookeeper-kafka - -Ddruid.s3.accessKey=AKIAIMKECRUYKDQGR6YQ - -Ddruid.s3.secretKey=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 + -Ddruid.s3.accessKey=AKIAJI7DG7CDECGBQ6NA + -Ddruid.s3.secretKey=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 -Ddruid.processing.buffer.sizeBytes=75000000 -Ddruid.processing.numThreads=3 -Ddruid.server.http.numThreads=100 diff --git a/integration-tests/docker/middlemanager.conf b/integration-tests/docker/middlemanager.conf index 2ca1560fb2c7..ea9db536428e 100644 --- a/integration-tests/docker/middlemanager.conf +++ b/integration-tests/docker/middlemanager.conf @@ -17,8 +17,8 @@ command=java -Ddruid.indexer.fork.property.druid.processing.buffer.sizeBytes=75000000 -Ddruid.indexer.fork.property.druid.processing.numThreads=1 -Ddruid.indexer.fork.server.http.numThreads=100 - -Ddruid.s3.accessKey=AKIAIMKECRUYKDQGR6YQ - -Ddruid.s3.secretKey=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 + -Ddruid.s3.accessKey=AKIAJI7DG7CDECGBQ6NA + -Ddruid.s3.secretKey=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 -Ddruid.worker.ip=%(ENV_HOST_IP)s -Ddruid.selectors.indexing.serviceName=druid/overlord -Ddruid.indexer.task.chathandler.type=announce diff --git a/services/src/main/java/io/druid/cli/CliBroker.java b/services/src/main/java/io/druid/cli/CliBroker.java index fd6de82de355..951202c40f42 100644 --- a/services/src/main/java/io/druid/cli/CliBroker.java +++ b/services/src/main/java/io/druid/cli/CliBroker.java @@ -46,6 +46,8 @@ import io.druid.guice.QueryableModule; import io.druid.guice.annotations.Self; import io.druid.java.util.common.logger.Logger; +import io.druid.metadata.MetadataStorage; +import io.druid.metadata.MetadataStorageProvider; import io.druid.query.QuerySegmentWalker; import io.druid.query.RetryQueryRunnerConfig; import io.druid.query.lookup.LookupModule; @@ -112,6 +114,9 @@ public void configure(Binder binder) JsonConfigProvider.bind(binder, "druid.broker.retryPolicy", RetryQueryRunnerConfig.class); JsonConfigProvider.bind(binder, "druid.broker.segment", BrokerSegmentWatcherConfig.class); + binder.bind(MetadataStorage.class).toProvider(MetadataStorageProvider.class); + LifecycleModule.register(binder, MetadataStorage.class); + binder.bind(QuerySegmentWalker.class).to(ClientQuerySegmentWalker.class).in(LazySingleton.class); binder.bind(JettyServerInitializer.class).to(QueryJettyServerInitializer.class).in(LazySingleton.class); diff --git a/services/src/main/java/io/druid/cli/CliRouter.java b/services/src/main/java/io/druid/cli/CliRouter.java index 51a9a8ef04d0..e44b80af1469 100644 --- a/services/src/main/java/io/druid/cli/CliRouter.java +++ b/services/src/main/java/io/druid/cli/CliRouter.java @@ -45,6 +45,8 @@ import io.druid.guice.http.JettyHttpClientModule; import io.druid.java.util.common.logger.Logger; import io.druid.java.util.http.client.HttpClient; +import io.druid.metadata.MetadataStorage; +import io.druid.metadata.MetadataStorageProvider; import io.druid.query.lookup.LookupModule; import io.druid.server.AsyncQueryForwardingServlet; import io.druid.server.http.RouterResource; @@ -112,6 +114,9 @@ public void configure(Binder binder) binder.bind(QueryCountStatsProvider.class).to(AsyncQueryForwardingServlet.class).in(LazySingleton.class); binder.bind(JettyServerInitializer.class).to(RouterJettyServerInitializer.class).in(LazySingleton.class); + binder.bind(MetadataStorage.class).toProvider(MetadataStorageProvider.class); + LifecycleModule.register(binder, MetadataStorage.class); + Jerseys.addResource(binder, RouterResource.class); LifecycleModule.register(binder, RouterResource.class);