From 935912a4a3e05052fec65da8b3c09c337b043b56 Mon Sep 17 00:00:00 2001 From: Aakash Nayak Date: Thu, 9 Jan 2025 16:06:04 +0530 Subject: [PATCH] Extracting encryption from cdap-security into cdap-common --- .../cdap/cdap/app/guice/AppFabricServiceRuntimeModule.java | 2 +- .../cdap/internal/credential/CredentialIdentityStore.java | 4 ++-- .../cdap/internal/credential/CredentialProfileStore.java | 4 ++-- .../internal/credential/CredentialProviderTestBase.java | 2 +- .../java/io/cdap/cdap/common}/encryption/AeadCipher.java | 2 +- .../io/cdap/cdap/common}/encryption/NoOpAeadCipher.java | 2 +- .../encryption/guice/AbstractAeadCipherProvider.java | 6 +++--- .../encryption/guice/AeadCipherCryptorExtensionLoader.java | 2 +- .../encryption/guice/DataStorageAeadCipherProvider.java | 4 ++-- .../encryption/guice/DataStorageAeadEncryptionModule.java | 4 ++-- .../common}/encryption/guice/LazyDelegateAeadCipher.java | 4 ++-- .../encryption/guice/UserCredentialAeadCipherProvider.java | 4 ++-- .../guice/UserCredentialAeadEncryptionModule.java | 4 ++-- .../encryption/DataStorageAeadEncryptionModuleTest.java | 4 ++-- .../io/cdap/cdap/common}/encryption/FakeAeadCipher.java | 2 +- .../io/cdap/cdap/common}/encryption/FakeAeadCipherTest.java | 2 +- .../encryption/UserCredentialAeadEncryptionModuleTest.java | 4 ++-- .../encryption/guice/LazyDelegateAeadCipherTest.java | 2 +- .../main/java/io/cdap/cdap/gateway/router/NettyRouter.java | 4 ++-- .../main/java/io/cdap/cdap/gateway/router/RouterMain.java | 2 +- .../cdap/gateway/router/handlers/AuthenticationHandler.java | 2 +- .../test/java/io/cdap/cdap/gateway/router/AuditLogTest.java | 2 +- .../io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java | 2 +- .../cdap/gateway/router/ConfigBasedRequestBlockingTest.java | 2 +- .../io/cdap/cdap/gateway/router/NettyRouterHttpTest.java | 2 +- .../io/cdap/cdap/gateway/router/NettyRouterHttpsTest.java | 2 +- .../io/cdap/cdap/gateway/router/NettyRouterTestBase.java | 2 +- .../java/io/cdap/cdap/gateway/router/RouterResource.java | 2 +- .../io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java | 2 +- .../cdap/cdap/master/environment/k8s/RouterServiceMain.java | 2 +- .../authorization/AuthorizationEnforcementModule.java | 2 +- .../cdap/security/authorization/DefaultAccessEnforcer.java | 6 ++---- .../security/authorization/DefaultAccessEnforcerTest.java | 2 +- 33 files changed, 46 insertions(+), 48 deletions(-) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/AeadCipher.java (98%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/NoOpAeadCipher.java (95%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/AbstractAeadCipherProvider.java (93%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/AeadCipherCryptorExtensionLoader.java (98%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/DataStorageAeadCipherProvider.java (94%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/DataStorageAeadEncryptionModule.java (93%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/LazyDelegateAeadCipher.java (96%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/UserCredentialAeadCipherProvider.java (96%) rename {cdap-security/src/main/java/io/cdap/cdap/security => cdap-common/src/main/java/io/cdap/cdap/common}/encryption/guice/UserCredentialAeadEncryptionModule.java (93%) rename {cdap-security/src/test/java/io/cdap/cdap/security => cdap-common/src/test/java/io/cdap/cdap/common}/encryption/DataStorageAeadEncryptionModuleTest.java (90%) rename {cdap-security/src/test/java/io/cdap/cdap/security => cdap-common/src/test/java/io/cdap/cdap/common}/encryption/FakeAeadCipher.java (99%) rename {cdap-security/src/test/java/io/cdap/cdap/security => cdap-common/src/test/java/io/cdap/cdap/common}/encryption/FakeAeadCipherTest.java (98%) rename {cdap-security/src/test/java/io/cdap/cdap/security => cdap-common/src/test/java/io/cdap/cdap/common}/encryption/UserCredentialAeadEncryptionModuleTest.java (90%) rename {cdap-security/src/test/java/io/cdap/cdap/security => cdap-common/src/test/java/io/cdap/cdap/common}/encryption/guice/LazyDelegateAeadCipherTest.java (98%) diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/AppFabricServiceRuntimeModule.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/AppFabricServiceRuntimeModule.java index 24c028a0471..38139536b46 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/AppFabricServiceRuntimeModule.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/app/guice/AppFabricServiceRuntimeModule.java @@ -46,6 +46,7 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.Constants.AppFabric; +import io.cdap.cdap.common.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.common.feature.DefaultFeatureFlagsProvider; import io.cdap.cdap.common.guice.RemoteAuthenticatorModules; import io.cdap.cdap.common.runtime.RuntimeModule; @@ -152,7 +153,6 @@ import io.cdap.cdap.scheduler.CoreSchedulerService; import io.cdap.cdap.scheduler.Scheduler; import io.cdap.cdap.securestore.spi.SecretStore; -import io.cdap.cdap.security.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.security.impersonation.DefaultOwnerAdmin; import io.cdap.cdap.security.impersonation.DefaultUGIProvider; import io.cdap.cdap.security.impersonation.OwnerAdmin; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialIdentityStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialIdentityStore.java index f7a83d1c63c..b2e85fa6d81 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialIdentityStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialIdentityStore.java @@ -18,11 +18,11 @@ import com.google.gson.Gson; import io.cdap.cdap.api.dataset.lib.CloseableIterator; +import io.cdap.cdap.common.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.proto.credential.CredentialIdentity; import io.cdap.cdap.proto.id.CredentialIdentityId; import io.cdap.cdap.proto.id.CredentialProfileId; -import io.cdap.cdap.security.encryption.AeadCipher; -import io.cdap.cdap.security.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.security.spi.encryption.CipherException; import io.cdap.cdap.spi.data.StructuredRow; import io.cdap.cdap.spi.data.StructuredTable; diff --git a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialProfileStore.java b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialProfileStore.java index 4580a543c51..79bb8679fd3 100644 --- a/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialProfileStore.java +++ b/cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialProfileStore.java @@ -18,11 +18,11 @@ import com.google.gson.Gson; import io.cdap.cdap.api.dataset.lib.CloseableIterator; +import io.cdap.cdap.common.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.common.NotFoundException; import io.cdap.cdap.proto.credential.CredentialProfile; import io.cdap.cdap.proto.id.CredentialProfileId; -import io.cdap.cdap.security.encryption.AeadCipher; -import io.cdap.cdap.security.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.security.spi.encryption.CipherException; import io.cdap.cdap.spi.data.StructuredRow; import io.cdap.cdap.spi.data.StructuredTable; diff --git a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/credential/CredentialProviderTestBase.java b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/credential/CredentialProviderTestBase.java index 2fee6d28710..fc6082f7ee3 100644 --- a/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/credential/CredentialProviderTestBase.java +++ b/cdap-app-fabric/src/test/java/io/cdap/cdap/internal/credential/CredentialProviderTestBase.java @@ -27,6 +27,7 @@ import com.google.inject.Scopes; import io.cdap.cdap.api.metrics.MetricsCollectionService; import io.cdap.cdap.common.conf.CConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.guice.ConfigModule; import io.cdap.cdap.common.metrics.NoOpMetricsCollectionService; import io.cdap.cdap.data.runtime.StorageModule; @@ -36,7 +37,6 @@ import io.cdap.cdap.proto.credential.ProvisionedCredential; import io.cdap.cdap.proto.id.CredentialProfileId; import io.cdap.cdap.security.authorization.AuthorizationEnforcementModule; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.cdap.security.spi.authorization.ContextAccessEnforcer; import io.cdap.cdap.security.spi.credential.CredentialProvider; import io.cdap.cdap.security.spi.credential.ProfileValidationException; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/AeadCipher.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/AeadCipher.java similarity index 98% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/AeadCipher.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/AeadCipher.java index f4635e7ac21..fc1c5e46250 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/AeadCipher.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/AeadCipher.java @@ -14,7 +14,7 @@ * the License. */ -package io.cdap.cdap.security.encryption; +package io.cdap.cdap.common.encryption; import io.cdap.cdap.security.spi.encryption.CipherException; import io.cdap.cdap.security.spi.encryption.CipherOperationException; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/NoOpAeadCipher.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/NoOpAeadCipher.java similarity index 95% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/NoOpAeadCipher.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/NoOpAeadCipher.java index ca2e4ff9960..4d9d39af9a7 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/NoOpAeadCipher.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/NoOpAeadCipher.java @@ -14,7 +14,7 @@ * the License. */ -package io.cdap.cdap.security.encryption; +package io.cdap.cdap.common.encryption; /** * Performs no encryption. diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/AbstractAeadCipherProvider.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AbstractAeadCipherProvider.java similarity index 93% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/AbstractAeadCipherProvider.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AbstractAeadCipherProvider.java index e10966733ab..4ec63356989 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/AbstractAeadCipherProvider.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AbstractAeadCipherProvider.java @@ -14,12 +14,12 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.SConfiguration; -import io.cdap.cdap.security.encryption.AeadCipher; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; +import io.cdap.cdap.common.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import java.util.Map; import javax.inject.Provider; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/AeadCipherCryptorExtensionLoader.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AeadCipherCryptorExtensionLoader.java similarity index 98% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/AeadCipherCryptorExtensionLoader.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AeadCipherCryptorExtensionLoader.java index 4a76529eee7..753ff255e98 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/AeadCipherCryptorExtensionLoader.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AeadCipherCryptorExtensionLoader.java @@ -14,7 +14,7 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import com.google.inject.Inject; import io.cdap.cdap.common.conf.CConfiguration; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/DataStorageAeadCipherProvider.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/DataStorageAeadCipherProvider.java similarity index 94% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/DataStorageAeadCipherProvider.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/DataStorageAeadCipherProvider.java index b89bcd69268..059eae834a3 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/DataStorageAeadCipherProvider.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/DataStorageAeadCipherProvider.java @@ -14,12 +14,12 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants.Security.Encryption; import io.cdap.cdap.common.conf.SConfiguration; -import io.cdap.cdap.security.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.AeadCipher; import java.util.Map; import javax.inject.Inject; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/DataStorageAeadEncryptionModule.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/DataStorageAeadEncryptionModule.java similarity index 93% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/DataStorageAeadEncryptionModule.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/DataStorageAeadEncryptionModule.java index d202f320910..7462b2b2527 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/DataStorageAeadEncryptionModule.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/DataStorageAeadEncryptionModule.java @@ -14,12 +14,12 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import com.google.inject.PrivateModule; import com.google.inject.Scopes; import com.google.inject.name.Names; -import io.cdap.cdap.security.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.AeadCipher; /** * Guice module for encryption bindings for data storage encryption. diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/LazyDelegateAeadCipher.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/LazyDelegateAeadCipher.java similarity index 96% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/LazyDelegateAeadCipher.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/LazyDelegateAeadCipher.java index 20a79630f07..754c9e33390 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/LazyDelegateAeadCipher.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/LazyDelegateAeadCipher.java @@ -14,9 +14,9 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; -import io.cdap.cdap.security.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.AeadCipher; import io.cdap.cdap.security.spi.encryption.AeadCipherContext; import io.cdap.cdap.security.spi.encryption.AeadCipherCryptor; import io.cdap.cdap.security.spi.encryption.CipherException; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/UserCredentialAeadCipherProvider.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/UserCredentialAeadCipherProvider.java similarity index 96% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/UserCredentialAeadCipherProvider.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/UserCredentialAeadCipherProvider.java index 3cf19eccae8..f081f5ac31b 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/UserCredentialAeadCipherProvider.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/UserCredentialAeadCipherProvider.java @@ -14,13 +14,13 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants.Security.Authentication; import io.cdap.cdap.common.conf.Constants.Security.Encryption; import io.cdap.cdap.common.conf.SConfiguration; -import io.cdap.cdap.security.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.AeadCipher; import java.util.Map; import javax.inject.Inject; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/UserCredentialAeadEncryptionModule.java b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/UserCredentialAeadEncryptionModule.java similarity index 93% rename from cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/UserCredentialAeadEncryptionModule.java rename to cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/UserCredentialAeadEncryptionModule.java index 3e75a012887..09e64843ce3 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/encryption/guice/UserCredentialAeadEncryptionModule.java +++ b/cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/UserCredentialAeadEncryptionModule.java @@ -14,12 +14,12 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import com.google.inject.PrivateModule; import com.google.inject.Scopes; import com.google.inject.name.Names; -import io.cdap.cdap.security.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.AeadCipher; /** * Guice module for encryption bindings for user credential encryption. diff --git a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/DataStorageAeadEncryptionModuleTest.java b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/DataStorageAeadEncryptionModuleTest.java similarity index 90% rename from cdap-security/src/test/java/io/cdap/cdap/security/encryption/DataStorageAeadEncryptionModuleTest.java rename to cdap-common/src/test/java/io/cdap/cdap/common/encryption/DataStorageAeadEncryptionModuleTest.java index 14aace96fc3..0ec91864dac 100644 --- a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/DataStorageAeadEncryptionModuleTest.java +++ b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/DataStorageAeadEncryptionModuleTest.java @@ -14,14 +14,14 @@ * the License. */ -package io.cdap.cdap.security.encryption; +package io.cdap.cdap.common.encryption; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.name.Names; +import io.cdap.cdap.common.encryption.guice.DataStorageAeadEncryptionModule; import io.cdap.cdap.common.guice.ConfigModule; -import io.cdap.cdap.security.encryption.guice.DataStorageAeadEncryptionModule; import org.junit.Test; /** diff --git a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/FakeAeadCipher.java b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/FakeAeadCipher.java similarity index 99% rename from cdap-security/src/test/java/io/cdap/cdap/security/encryption/FakeAeadCipher.java rename to cdap-common/src/test/java/io/cdap/cdap/common/encryption/FakeAeadCipher.java index 41001e7321a..156aa899c06 100644 --- a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/FakeAeadCipher.java +++ b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/FakeAeadCipher.java @@ -14,7 +14,7 @@ * the License. */ -package io.cdap.cdap.security.encryption; +package io.cdap.cdap.common.encryption; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; diff --git a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/FakeAeadCipherTest.java b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/FakeAeadCipherTest.java similarity index 98% rename from cdap-security/src/test/java/io/cdap/cdap/security/encryption/FakeAeadCipherTest.java rename to cdap-common/src/test/java/io/cdap/cdap/common/encryption/FakeAeadCipherTest.java index 23e4359cf3e..9c1bd43afff 100644 --- a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/FakeAeadCipherTest.java +++ b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/FakeAeadCipherTest.java @@ -14,7 +14,7 @@ * the License. */ -package io.cdap.cdap.security.encryption; +package io.cdap.cdap.common.encryption; import com.google.gson.Gson; import io.cdap.cdap.security.spi.encryption.CipherOperationException; diff --git a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/UserCredentialAeadEncryptionModuleTest.java b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/UserCredentialAeadEncryptionModuleTest.java similarity index 90% rename from cdap-security/src/test/java/io/cdap/cdap/security/encryption/UserCredentialAeadEncryptionModuleTest.java rename to cdap-common/src/test/java/io/cdap/cdap/common/encryption/UserCredentialAeadEncryptionModuleTest.java index 0f9b529cd39..7c1d2c9ec3c 100644 --- a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/UserCredentialAeadEncryptionModuleTest.java +++ b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/UserCredentialAeadEncryptionModuleTest.java @@ -14,14 +14,14 @@ * the License. */ -package io.cdap.cdap.security.encryption; +package io.cdap.cdap.common.encryption; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.name.Names; +import io.cdap.cdap.common.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.common.guice.ConfigModule; -import io.cdap.cdap.security.encryption.guice.UserCredentialAeadEncryptionModule; import org.junit.Test; /** diff --git a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/guice/LazyDelegateAeadCipherTest.java b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/guice/LazyDelegateAeadCipherTest.java similarity index 98% rename from cdap-security/src/test/java/io/cdap/cdap/security/encryption/guice/LazyDelegateAeadCipherTest.java rename to cdap-common/src/test/java/io/cdap/cdap/common/encryption/guice/LazyDelegateAeadCipherTest.java index 9e8d6ec9a4c..50c0ae5d670 100644 --- a/cdap-security/src/test/java/io/cdap/cdap/security/encryption/guice/LazyDelegateAeadCipherTest.java +++ b/cdap-common/src/test/java/io/cdap/cdap/common/encryption/guice/LazyDelegateAeadCipherTest.java @@ -14,7 +14,7 @@ * the License. */ -package io.cdap.cdap.security.encryption.guice; +package io.cdap.cdap.common.encryption.guice; import static org.mockito.Matchers.any; import static org.mockito.Matchers.argThat; diff --git a/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java b/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java index 415fe221a98..02287460758 100644 --- a/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java +++ b/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java @@ -26,6 +26,8 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.common.security.HttpsEnabler; import io.cdap.cdap.common.security.KeyStores; import io.cdap.cdap.gateway.router.handlers.AuditLogHandler; @@ -35,8 +37,6 @@ import io.cdap.cdap.gateway.router.handlers.HttpStatusRequestHandler; import io.cdap.cdap.security.auth.TokenValidator; import io.cdap.cdap.security.auth.UserIdentityExtractor; -import io.cdap.cdap.security.encryption.AeadCipher; -import io.cdap.cdap.security.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.security.impersonation.SecurityUtil; import io.cdap.http.SSLConfig; import io.cdap.http.SSLHandlerFactory; diff --git a/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/RouterMain.java b/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/RouterMain.java index d3348d0d4e8..970a6135fbd 100644 --- a/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/RouterMain.java +++ b/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/RouterMain.java @@ -23,13 +23,13 @@ import io.cdap.cdap.common.ServiceBindException; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; +import io.cdap.cdap.common.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.common.guice.ConfigModule; import io.cdap.cdap.common.guice.IOModule; import io.cdap.cdap.common.guice.RemoteAuthenticatorModules; import io.cdap.cdap.common.guice.ZkClientModule; import io.cdap.cdap.common.guice.ZkDiscoveryModule; import io.cdap.cdap.common.runtime.DaemonMain; -import io.cdap.cdap.security.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.security.guice.CoreSecurityRuntimeModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import io.cdap.cdap.security.impersonation.SecurityUtil; diff --git a/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java b/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java index f408378e565..d7a09643449 100644 --- a/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java +++ b/cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java @@ -24,6 +24,7 @@ import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.Constants.Security.Encryption; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.AeadCipher; import io.cdap.cdap.common.logging.AuditLogEntry; import io.cdap.cdap.common.utils.Networks; import io.cdap.cdap.proto.security.Credential; @@ -32,7 +33,6 @@ import io.cdap.cdap.security.auth.UserIdentityExtractionState; import io.cdap.cdap.security.auth.UserIdentityExtractor; import io.cdap.cdap.security.auth.UserIdentityPair; -import io.cdap.cdap.security.encryption.AeadCipher; import io.cdap.cdap.security.server.GrantAccessToken; import io.cdap.cdap.security.spi.encryption.CipherException; import io.netty.buffer.ByteBuf; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuditLogTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuditLogTest.java index 90fefaf6971..30db4cab809 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuditLogTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuditLogTest.java @@ -28,10 +28,10 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.security.AuditDetail; import io.cdap.cdap.common.security.AuditPolicy; import io.cdap.cdap.security.auth.TokenValidator; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.http.AbstractHttpHandler; import io.cdap.http.HttpResponder; import io.cdap.http.NettyHttpService; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java index 79591fd481e..2bffff41771 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java @@ -25,13 +25,13 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.guice.InMemoryDiscoveryModule; import io.cdap.cdap.internal.guava.reflect.TypeToken; import io.cdap.cdap.internal.guice.AppFabricTestModule; import io.cdap.cdap.security.auth.AuthenticationMode; import io.cdap.cdap.security.auth.TokenValidator; import io.cdap.cdap.security.auth.UserIdentityExtractor; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.cdap.security.guice.CoreSecurityRuntimeModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import io.cdap.cdap.security.server.GrantAccessToken; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/ConfigBasedRequestBlockingTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/ConfigBasedRequestBlockingTest.java index a8c09c9535c..48ff938ef4b 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/ConfigBasedRequestBlockingTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/ConfigBasedRequestBlockingTest.java @@ -21,8 +21,8 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.security.auth.TokenValidator; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.http.NettyHttpService; import io.netty.handler.codec.http.HttpResponseStatus; import java.io.IOException; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpTest.java index 1d0589db02c..3169cc9caa2 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpTest.java @@ -25,10 +25,10 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.guice.InMemoryDiscoveryModule; import io.cdap.cdap.internal.guice.AppFabricTestModule; import io.cdap.cdap.security.auth.UserIdentityExtractor; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.cdap.security.guice.CoreSecurityRuntimeModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import java.net.InetSocketAddress; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpsTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpsTest.java index 7411f3c43db..e112b344a1a 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpsTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterHttpsTest.java @@ -25,12 +25,12 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.guice.InMemoryDiscoveryModule; import io.cdap.cdap.common.security.KeyStores; import io.cdap.cdap.common.security.KeyStoresTest; import io.cdap.cdap.internal.guice.AppFabricTestModule; import io.cdap.cdap.security.auth.UserIdentityExtractor; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.cdap.security.guice.CoreSecurityRuntimeModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import io.cdap.common.http.HttpRequests; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterTestBase.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterTestBase.java index a264d964b9e..06ec876f3b8 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterTestBase.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/NettyRouterTestBase.java @@ -36,9 +36,9 @@ import io.cdap.cdap.common.conf.SConfiguration; import io.cdap.cdap.common.discovery.RandomEndpointStrategy; import io.cdap.cdap.common.discovery.ResolvingDiscoverable; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.http.AbstractBodyConsumer; import io.cdap.cdap.security.auth.TokenValidator; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.http.AbstractHttpHandler; import io.cdap.http.BodyConsumer; import io.cdap.http.ChannelPipelineModifier; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java index 90c2f640469..cca9d8d4bfc 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java @@ -22,11 +22,11 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.guice.InMemoryDiscoveryModule; import io.cdap.cdap.internal.guice.AppFabricTestModule; import io.cdap.cdap.security.auth.TokenValidator; import io.cdap.cdap.security.auth.UserIdentityExtractor; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.cdap.security.guice.CoreSecurityRuntimeModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import java.net.InetSocketAddress; diff --git a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java index 14c9a561d09..2e64a3bc5cd 100644 --- a/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java +++ b/cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java @@ -24,11 +24,11 @@ import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.NoOpAeadCipher; import io.cdap.cdap.common.guice.InMemoryDiscoveryModule; import io.cdap.cdap.common.utils.Networks; import io.cdap.cdap.internal.guice.AppFabricTestModule; import io.cdap.cdap.security.auth.UserIdentityExtractor; -import io.cdap.cdap.security.encryption.NoOpAeadCipher; import io.cdap.cdap.security.guice.CoreSecurityRuntimeModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import io.cdap.http.AbstractHttpHandler; diff --git a/cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/RouterServiceMain.java b/cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/RouterServiceMain.java index b02ed6dd5cd..07dce6866fa 100644 --- a/cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/RouterServiceMain.java +++ b/cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/RouterServiceMain.java @@ -23,6 +23,7 @@ import com.google.inject.Module; import io.cdap.cdap.common.conf.CConfiguration; import io.cdap.cdap.common.conf.Constants; +import io.cdap.cdap.common.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.common.guice.DFSLocationModule; import io.cdap.cdap.common.logging.LoggingContext; import io.cdap.cdap.common.logging.ServiceLoggingContext; @@ -32,7 +33,6 @@ import io.cdap.cdap.master.spi.environment.MasterEnvironmentContext; import io.cdap.cdap.messaging.guice.MessagingServiceModule; import io.cdap.cdap.proto.id.NamespaceId; -import io.cdap.cdap.security.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.security.guice.ExternalAuthenticationModule; import java.util.ArrayList; import java.util.List; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/authorization/AuthorizationEnforcementModule.java b/cdap-security/src/main/java/io/cdap/cdap/security/authorization/AuthorizationEnforcementModule.java index 965938587f9..d10093c4217 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/authorization/AuthorizationEnforcementModule.java +++ b/cdap-security/src/main/java/io/cdap/cdap/security/authorization/AuthorizationEnforcementModule.java @@ -22,11 +22,11 @@ import com.google.inject.Scopes; import com.google.inject.name.Names; import io.cdap.cdap.common.conf.CConfiguration; +import io.cdap.cdap.common.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.common.runtime.RuntimeModule; import io.cdap.cdap.proto.element.EntityType; import io.cdap.cdap.proto.id.EntityId; import io.cdap.cdap.proto.security.Permission; -import io.cdap.cdap.security.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.security.impersonation.SecurityUtil; import io.cdap.cdap.security.spi.authorization.AccessEnforcer; import io.cdap.cdap.security.spi.authorization.ContextAccessEnforcer; diff --git a/cdap-security/src/main/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcer.java b/cdap-security/src/main/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcer.java index d9e88dad3e6..28ae6f60d53 100644 --- a/cdap-security/src/main/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcer.java +++ b/cdap-security/src/main/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcer.java @@ -26,6 +26,8 @@ import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.Constants.Security.Encryption; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.AeadCipher; +import io.cdap.cdap.common.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.proto.element.EntityType; import io.cdap.cdap.proto.id.EntityId; import io.cdap.cdap.proto.id.InstanceId; @@ -36,18 +38,14 @@ import io.cdap.cdap.proto.security.Permission; import io.cdap.cdap.proto.security.Principal; import io.cdap.cdap.proto.security.Role; -import io.cdap.cdap.security.encryption.AeadCipher; -import io.cdap.cdap.security.encryption.guice.UserCredentialAeadEncryptionModule; import io.cdap.cdap.security.impersonation.SecurityUtil; import io.cdap.cdap.security.spi.authentication.AuthenticationContext; import io.cdap.cdap.security.spi.authorization.AccessEnforcer; -import io.cdap.cdap.security.spi.authorization.AuditLogContext; import io.cdap.cdap.security.spi.authorization.AuthorizationResponse; import io.cdap.cdap.security.spi.authorization.AuthorizedResult; import io.cdap.cdap.security.spi.encryption.CipherException; import java.util.Collections; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; diff --git a/cdap-security/src/test/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcerTest.java b/cdap-security/src/test/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcerTest.java index 345e097272c..de6d4d9d8b7 100644 --- a/cdap-security/src/test/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcerTest.java +++ b/cdap-security/src/test/java/io/cdap/cdap/security/authorization/DefaultAccessEnforcerTest.java @@ -31,6 +31,7 @@ import io.cdap.cdap.common.conf.Constants; import io.cdap.cdap.common.conf.Constants.Security.Encryption; import io.cdap.cdap.common.conf.SConfiguration; +import io.cdap.cdap.common.encryption.FakeAeadCipher; import io.cdap.cdap.common.metrics.ProgramTypeMetricTag; import io.cdap.cdap.common.test.AppJarHelper; import io.cdap.cdap.proto.ProgramType; @@ -47,7 +48,6 @@ import io.cdap.cdap.proto.security.StandardPermission; import io.cdap.cdap.security.auth.CipherException; import io.cdap.cdap.security.auth.context.AuthenticationTestContext; -import io.cdap.cdap.security.encryption.FakeAeadCipher; import io.cdap.cdap.security.spi.authentication.AuthenticationContext; import io.cdap.cdap.security.spi.authorization.AccessControllerSpi; import io.cdap.cdap.security.spi.authorization.AccessEnforcer;