Skip to content

Commit

Permalink
[KYUUBI apache#1981] Remove unused artifacts for common and parent mo…
Browse files Browse the repository at this point in the history
…dule

### _Why are the changes needed?_

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes apache#1981 from yaooqinn/branch-dep.

Closes apache#1981

07bf0e2 [Kent Yao] codec
96e41e7 [Kent Yao] codec
1da2643 [Kent Yao] guava
6cf0abb [Kent Yao] base64 & sha1
3b45ec2 [Kent Yao] base64
5490cfa [Kent Yao] http
6f4b48b [Kent Yao] n
2a87a4c [Kent Yao] d
a5ad3cc [Kent Yao] Refine Deps in common module
24d5299 [Kent Yao] Refine Deps in common module

Authored-by: Kent Yao <yao@apache.org>
Signed-off-by: Kent Yao <yao@apache.org>
  • Loading branch information
yaooqinn committed Mar 1, 2022
1 parent 5c0c760 commit d6bbe32
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 56 deletions.
3 changes: 0 additions & 3 deletions dev/dependencyList
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

aopalliance-repackaged/2.6.1//aopalliance-repackaged-2.6.1.jar
classgraph/4.8.95//classgraph-4.8.95.jar
commons-codec/1.15//commons-codec-1.15.jar
commons-lang/2.6//commons-lang-2.6.jar
commons-lang3/3.10//commons-lang3-3.10.jar
curator-client/2.12.0//curator-client-2.12.0.jar
Expand All @@ -36,8 +35,6 @@ hk2-api/2.6.1//hk2-api-2.6.1.jar
hk2-locator/2.6.1//hk2-locator-2.6.1.jar
hk2-utils/2.6.1//hk2-utils-2.6.1.jar
htrace-core4/4.1.0-incubating//htrace-core4-4.1.0-incubating.jar
httpclient/4.5.13//httpclient-4.5.13.jar
httpcore/4.4.15//httpcore-4.4.15.jar
jackson-annotations/2.13.1//jackson-annotations-2.13.1.jar
jackson-core/2.13.1//jackson-core-2.13.1.jar
jackson-databind/2.13.1//jackson-databind-2.13.1.jar
Expand Down
21 changes: 6 additions & 15 deletions kyuubi-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,19 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-runtime</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libfb303</artifactId>
Expand All @@ -109,11 +105,6 @@
<artifactId>hive-service-rpc</artifactId>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_${scala.binary.version}</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ package org.apache.kyuubi.service.authentication
import java.io.IOException
import java.net.InetAddress
import java.security.PrivilegedAction
import java.util.Base64
import javax.security.auth.callback._
import javax.security.sasl.{AuthorizeCallback, RealmCallback}

import org.apache.commons.codec.binary.Base64
import org.apache.hadoop.fs.FileSystem
import org.apache.hadoop.security.{SaslRpcServer, UserGroupInformation}
import org.apache.hadoop.security.SaslRpcServer.AuthMethod
Expand Down Expand Up @@ -190,7 +190,7 @@ object HadoopThriftAuthBridgeServer {

def getPasswd(identifier: KyuubiDelegationTokenIdentifier): Array[Char] = {
val passwd = secretMgr.retrievePassword(identifier)
new String(Base64.encodeBase64(passwd)).toCharArray
Base64.getMimeEncoder.encodeToString(passwd).toCharArray
}

override def handle(callbacks: Array[Callback]): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
package org.apache.kyuubi.util

import java.io.{ByteArrayInputStream, ByteArrayOutputStream, DataInputStream, DataOutputStream}
import java.util.{Map => JMap}
import java.util.{Base64, Map => JMap}

import scala.collection.JavaConverters._

import org.apache.commons.codec.binary.Base64
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier
import org.apache.hadoop.io.Text
Expand Down Expand Up @@ -58,13 +57,11 @@ object KyuubiHadoopUtils {
val byteStream = new ByteArrayOutputStream
creds.writeTokenStorageToStream(new DataOutputStream(byteStream))

val encoder = new Base64(0, null, false)
encoder.encodeToString(byteStream.toByteArray)
Base64.getMimeEncoder.encodeToString(byteStream.toByteArray)
}

def decodeCredentials(newValue: String): Credentials = {
val decoder = new Base64(0, null, false)
val decoded = decoder.decode(newValue)
val decoded = Base64.getMimeDecoder.decode(newValue)

val byteStream = new ByteArrayInputStream(decoded)
val creds = new Credentials()
Expand Down
5 changes: 5 additions & 0 deletions kyuubi-ha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
<artifactId>zookeeper</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>org.apache.kyuubi</groupId>
<artifactId>kyuubi-common_${scala.binary.version}</artifactId>
Expand Down
1 change: 0 additions & 1 deletion kyuubi-hive-jdbc-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${hive.client.commons-codec.version}</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import javax.net.ssl.TrustManagerFactory;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.hive.common.auth.HiveAuthUtils;
import org.apache.hive.service.auth.HiveAuthFactory;
Expand Down Expand Up @@ -787,8 +786,8 @@ private void openSession() throws SQLException {

if (launchEngineOpHandleGuid != null && launchEngineOpHandleSecret != null) {
try {
byte[] guidBytes = Base64.decodeBase64(launchEngineOpHandleGuid);
byte[] secretBytes = Base64.decodeBase64(launchEngineOpHandleSecret);
byte[] guidBytes = Base64.getMimeDecoder().decode(launchEngineOpHandleGuid);
byte[] secretBytes = Base64.getMimeDecoder().decode(launchEngineOpHandleSecret);
THandleIdentifier handleIdentifier =
new THandleIdentifier(ByteBuffer.wrap(guidBytes), ByteBuffer.wrap(secretBytes));
launchEngineOpHandle =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLTimeoutException;
import java.sql.SQLWarning;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import java.util.*;
import org.apache.hive.service.cli.RowSet;
import org.apache.hive.service.cli.RowSetFactory;
import org.apache.hive.service.rpc.thrift.TCLIService;
Expand Down Expand Up @@ -988,7 +983,7 @@ public String getYarnATSGuid() {
// Set on the server side.
// @see org.apache.hive.service.cli.operation.SQLOperation#prepare
String guid64 =
Base64.encodeBase64URLSafeString(stmtHandle.getOperationId().getGuid()).trim();
Base64.getUrlEncoder().encodeToString(stmtHandle.getOperationId().getGuid()).trim();
return guid64;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.kyuubi.metrics

import com.codahale.metrics.MetricRegistry
import com.google.common.annotations.VisibleForTesting
import io.prometheus.client.CollectorRegistry
import io.prometheus.client.dropwizard.DropwizardExports
import io.prometheus.client.exporter.MetricsServlet
Expand All @@ -34,7 +33,7 @@ class PrometheusReporterService(registry: MetricRegistry)

private val bridgeRegistry = new CollectorRegistry

@VisibleForTesting
// VisibleForTesting
private[metrics] var httpServer: Server = _
@volatile protected var isStarted = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

package org.apache.kyuubi.server

import org.apache.commons.codec.binary.Base64
import java.util.Base64

import org.apache.hive.service.rpc.thrift.{TOpenSessionReq, TOpenSessionResp}

import org.apache.kyuubi.KyuubiSQLException
Expand Down Expand Up @@ -52,10 +53,10 @@ final class KyuubiTBinaryFrontendService(
val opHandleIdentifier = launchEngineOp.getHandle.identifier.toTHandleIdentifier
respConfiguration.put(
"kyuubi.session.engine.launch.handle.guid",
Base64.encodeBase64String(opHandleIdentifier.getGuid))
Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getGuid))
respConfiguration.put(
"kyuubi.session.engine.launch.handle.secret",
Base64.encodeBase64String(opHandleIdentifier.getSecret))
Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getSecret))

resp.setSessionHandle(sessionHandle.toTSessionHandle)
resp.setConfiguration(respConfiguration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.kyuubi.server.mysql.authentication

import java.util

import org.apache.commons.codec.digest.DigestUtils
import java.nio.charset.StandardCharsets
import java.security.MessageDigest
import java.util.Arrays

import org.apache.kyuubi.server.mysql.authentication.MySQLAuthentication.randomBytes
import org.apache.kyuubi.server.mysql.authentication.MySQLNativePassword.PluginData
Expand Down Expand Up @@ -52,16 +52,17 @@ class MySQLNativePassword {
}

private[authentication] def isPasswordRight(password: String, authentication: Array[Byte]) =
util.Arrays.equals(getAuthCipherBytes(password), authentication)
Arrays.equals(getAuthCipherBytes(password), authentication)

private def getAuthCipherBytes(password: String): Array[Byte] = {
val salt = pluginData.full
val passwordSha1 = DigestUtils.sha1(password)
val passwordSha1Sha1 = DigestUtils.sha1(passwordSha1)
val sha1 = MessageDigest.getInstance("SHA-1")
val passwordSha1 = sha1.digest(password.getBytes(StandardCharsets.UTF_8))
val passwordSha1Sha1 = sha1.digest(passwordSha1)
val secret = new Array[Byte](salt.length + passwordSha1Sha1.length)
System.arraycopy(salt, 0, secret, 0, salt.length)
System.arraycopy(passwordSha1Sha1, 0, secret, salt.length, passwordSha1Sha1.length)
val secretSha1 = DigestUtils.sha1(secret)
val secretSha1 = sha1.digest(secret)
xor(passwordSha1, secretSha1)
}

Expand Down
6 changes: 6 additions & 0 deletions kyuubi-zookeeper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
<artifactId>curator-client</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
15 changes: 8 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@

<!-- apply to kyuubi-hive-jdbc/kyuubi-hive-beeline module -->
<hive.client.commons-cli.version>1.2</hive.client.commons-cli.version>
<hive.client.commons-codec.version>1.15</hive.client.commons-codec.version>
<hive.client.httpcomponents-client.version>4.5.13</hive.client.httpcomponents-client.version>
<hive.client.httpcomponents-core.version>4.4.13</hive.client.httpcomponents-core.version>
<hive.client.jline.version>2.12</hive.client.jline.version>
Expand Down Expand Up @@ -525,6 +524,12 @@
<groupId>org.apache.thrift</groupId>
<artifactId>libfb303</artifactId>
<version>${fb303.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -533,12 +538,8 @@
<version>${thrift.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down

0 comments on commit d6bbe32

Please sign in to comment.