Skip to content

Commit

Permalink
Extracting encryption from cdap-security into cdap-common
Browse files Browse the repository at this point in the history
  • Loading branch information
masivesky committed Jan 9, 2025
1 parent 1ef91ed commit 935912a
Show file tree
Hide file tree
Showing 33 changed files with 46 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check warning on line 23 in cdap-app-fabric/src/main/java/io/cdap/cdap/internal/credential/CredentialProfileStore.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck

Wrong lexicographical order for 'io.cdap.cdap.common.NotFoundException' import. Should be before 'io.cdap.cdap.common.encryption.guice.DataStorageAeadEncryptionModule'.
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* the License.
*/

package io.cdap.cdap.security.encryption;
package io.cdap.cdap.common.encryption;

/**
* Performs no encryption.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 935912a

Please sign in to comment.