Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting encryption from cdap-security into cdap-common #15786

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import io.cdap.cdap.common.conf.Constants;
import io.cdap.cdap.common.conf.Constants.AppFabric;
import io.cdap.cdap.common.conf.Constants.Service;
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 @@ -153,7 +154,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 All @@ -28,13 +28,13 @@
*/
public abstract class AbstractAeadCipherProvider implements Provider<AeadCipher> {

private final String NOOP_AEAD_CIPHER_NAME = "NONE";

Check warning on line 31 in cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AbstractAeadCipherProvider.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'NOOP_AEAD_CIPHER_NAME' must contain no more than '1' consecutive capital letters.

Check warning on line 31 in cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AbstractAeadCipherProvider.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck

Member name 'NOOP_AEAD_CIPHER_NAME' must match pattern '^[a-z][a-zA-Z0-9]+$'.

private final AeadCipherCryptorExtensionLoader aeadCipherCryptorExtensionLoader;
final CConfiguration cConf;
final SConfiguration sConf;

public AbstractAeadCipherProvider(

Check warning on line 37 in cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AbstractAeadCipherProvider.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
AeadCipherCryptorExtensionLoader aeadCipherCryptorExtensionLoader,
CConfiguration cConf, SConfiguration sConf) {
this.cConf = cConf;
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 All @@ -27,7 +27,7 @@
import java.util.Collections;
import java.util.Set;

public class AeadCipherCryptorExtensionLoader extends

Check warning on line 30 in cdap-common/src/main/java/io/cdap/cdap/common/encryption/guice/AeadCipherCryptorExtensionLoader.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck

Missing a Javadoc comment.
AbstractExtensionLoader<String, AeadCipherCryptor> {

private volatile Set<String> allowedResources;
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 Expand Up @@ -103,7 +103,7 @@

private ScheduledExecutorService scheduledExecutorService;

@Inject

Check warning on line 106 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
public NettyRouter(CConfiguration cConf, SConfiguration sConf,
@Named(Constants.Router.ADDRESS) InetAddress hostname,
RouterServiceLookup serviceLookup, TokenValidator tokenValidator,
Expand Down Expand Up @@ -213,7 +213,7 @@
}
}

SSLHandlerFactory finalSSLHandlerFactory = sslHandlerFactory;

Check warning on line 216 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'finalSSLHandlerFactory' must contain no more than '1' consecutive capital letters.
return new ServerBootstrap()
.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
Expand Down Expand Up @@ -279,7 +279,7 @@
};
}

/**

Check warning on line 282 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/NettyRouter.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck

First sentence of Javadoc is missing an ending period.
* A daemon thread to reload {@link #cConf} periodically
*/
private void scheduleConfigReloadThread() {
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 Expand Up @@ -84,12 +84,12 @@
private final String realm;
private final Pattern bypassPattern;
private final boolean auditLogEnabled;
private final List<String> authServerURLs;

Check warning on line 87 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'authServerURLs' must contain no more than '1' consecutive capital letters.
private final DiscoveryServiceClient discoveryServiceClient;
private final UserIdentityExtractor userIdentityExtractor;
private final AeadCipher userCredentialAeadCipher;

public AuthenticationHandler(CConfiguration cConf, SConfiguration sConf,

Check warning on line 92 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
DiscoveryServiceClient discoveryServiceClient,
UserIdentityExtractor userIdentityExtractor,
AeadCipher userCredentialAeadCipher) {
Expand Down Expand Up @@ -134,7 +134,7 @@
}
request.headers().set(Constants.Security.Headers.USER_ID,
userIdentityPair.getUserIdentity().getUsername());
String clientIP = Networks.getIP(ctx.channel().remoteAddress());

Check warning on line 137 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'clientIP' must contain no more than '1' consecutive capital letters.
if (clientIP != null) {
request.headers().set(Constants.Security.Headers.USER_IP, clientIP);
}
Expand Down Expand Up @@ -191,7 +191,7 @@
/**
* Gets a {@link JsonArray} of url strings to the authentication server instances.
*/
private JsonArray getAuthenticationURLs() {

Check warning on line 194 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'getAuthenticationURLs' must contain no more than '1' consecutive capital letters.
// If the auth server urls are known via configuration, just use it
final JsonArray result = new JsonArray();

Expand Down Expand Up @@ -298,7 +298,7 @@
}
}

private static List<String> getConfiguredAuthServerURLs(CConfiguration cConf) {

Check warning on line 301 in cdap-gateway/src/main/java/io/cdap/cdap/gateway/router/handlers/AuthenticationHandler.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'getConfiguredAuthServerURLs' must contain no more than '1' consecutive capital letters.
List<String> urls = new ArrayList<>();
// Get it from the configuration
for (String url : cConf.getTrimmedStrings(Constants.Security.AUTH_SERVER_ANNOUNCE_URLS)) {
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 Expand Up @@ -87,7 +87,7 @@
.setLevel(Level.TRACE);

CConfiguration cConf = CConfiguration.create();
SConfiguration sConf = SConfiguration.create();

Check warning on line 90 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuditLogTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'sConf' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

cConf.set(Constants.Router.ADDRESS, InetAddress.getLoopbackAddress().getHostAddress());
cConf.setInt(Constants.Router.ROUTER_PORT, 0);
Expand Down Expand Up @@ -162,7 +162,7 @@
"\"POST /postHeaders HTTP/1.1\" {user-id=cdap} Post Headers 200 12 Post Headers"));
}

private HttpURLConnection createURLConnection(String path, HttpMethod method) throws IOException {

Check warning on line 165 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuditLogTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'createURLConnection' must contain no more than '1' consecutive capital letters.
HttpURLConnection urlConn = (HttpURLConnection) baseURI.resolve(path).toURL().openConnection();
urlConn.setRequestMethod(method.name());
if (method.equals(HttpMethod.PUT) || method.equals(HttpMethod.POST)) {
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 Expand Up @@ -66,7 +66,7 @@
}.getType();

@Test
public void testEmptyAnnounceAddressURLsConfig() throws Exception {

Check warning on line 69 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'testEmptyAnnounceAddressURLsConfig' must contain no more than '1' consecutive capital letters.
HttpRouterService routerService = new AuthServerAnnounceTest.HttpRouterService(HOSTNAME,
DISCOVERY_SERVICE);
routerService.startUp();
Expand All @@ -78,7 +78,7 @@
}

@Test
public void testAnnounceURLsConfig() throws Exception {

Check warning on line 81 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'testAnnounceURLsConfig' must contain no more than '1' consecutive capital letters.
HttpRouterService routerService = new AuthServerAnnounceTest.HttpRouterService(HOSTNAME,
DISCOVERY_SERVICE);
routerService.cConf.set(Constants.Security.AUTH_SERVER_ANNOUNCE_URLS, ANNOUNCE_URLS);
Expand All @@ -93,7 +93,7 @@
}
}

private List<String> getAuthURI(HttpRouterService routerService)

Check warning on line 96 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'getAuthURI' must contain no more than '1' consecutive capital letters.
throws IOException, URISyntaxException {
DefaultHttpClient client = new DefaultHttpClient();
String url = resolveURI("/v3/apps", routerService);
Expand All @@ -104,7 +104,7 @@
return responseMap.get("auth_uri");
}

private String resolveURI(String path, HttpRouterService routerService)

Check warning on line 107 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck

Abbreviation in name 'resolveURI' must contain no more than '1' consecutive capital letters.
throws URISyntaxException {
InetSocketAddress address = routerService.getRouterAddress();
return new URI(String.format("%s://%s:%d", "http", address.getHostName(),
Expand All @@ -125,15 +125,15 @@

@Override
protected void startUp() {
SConfiguration sConfiguration = SConfiguration.create();

Check warning on line 128 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'sConfiguration' declaration and its first usage is 6, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
Injector injector = Guice.createInjector(new CoreSecurityRuntimeModule().getInMemoryModules(),
new ExternalAuthenticationModule(),
new InMemoryDiscoveryModule(),
new AppFabricTestModule(cConf));
DiscoveryServiceClient discoveryServiceClient = injector

Check warning on line 133 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'discoveryServiceClient' declaration and its first usage is 6, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
.getInstance(DiscoveryServiceClient.class);
TokenValidator validator = new MissingTokenValidator();
UserIdentityExtractor userIdentityExtractor = new MockAccessTokenIdentityExtractor(validator);

Check warning on line 136 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/AuthServerAnnounceTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'userIdentityExtractor' declaration and its first usage is 6, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
cConf.set(Constants.Router.ADDRESS, hostname);
cConf.setInt(Constants.Router.ROUTER_PORT, 0);
cConf.setInt(Constants.Router.CONNECTION_TIMEOUT_SECS, CONNECTION_IDLE_TIMEOUT_SECS);
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 Expand Up @@ -62,11 +62,11 @@
new ExternalAuthenticationModule(),
new InMemoryDiscoveryModule(),
new AppFabricTestModule(cConf));
DiscoveryServiceClient discoveryServiceClient = injector

Check warning on line 65 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'discoveryServiceClient' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
.getInstance(DiscoveryServiceClient.class);
TokenValidator mockValidator = new MockTokenValidator("failme");
UserIdentityExtractor extractor = new MockAccessTokenIdentityExtractor(mockValidator);

Check warning on line 68 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'extractor' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
SConfiguration sConf = injector.getInstance(SConfiguration.class);

Check warning on line 69 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RouterResource.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'sConf' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
cConf.set(Constants.Router.ADDRESS, hostname);
cConf.setInt(Constants.Router.ROUTER_PORT, 0);
for (Map.Entry<String, String> entry : additionalConfig.entrySet()) {
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 Expand Up @@ -71,11 +71,11 @@
new AppFabricTestModule(cConf));

// Starting router
DiscoveryServiceClient discoveryServiceClient = injector

Check warning on line 74 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'discoveryServiceClient' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
.getInstance(DiscoveryServiceClient.class);
UserIdentityExtractor userIdentityExtractor = injector.getInstance(UserIdentityExtractor.class);

Check warning on line 76 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'userIdentityExtractor' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).

SConfiguration sConf = SConfiguration.create();

Check warning on line 78 in cdap-gateway/src/test/java/io/cdap/cdap/gateway/router/RoutingToDataSetsTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck

Distance between variable 'sConf' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
cConf.set(Constants.Router.ADDRESS, "localhost");
port = Networks.getRandomPort();

Expand Down
Loading
Loading