pan3793 commented on code in PR #7182:
URL: https://github.com/apache/kyuubi/pull/7182#discussion_r2324165054


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/credentials/HBaseDelegationTokenProvider.scala:
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.credentials
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.hbase.client.ConnectionFactory
+import org.apache.hadoop.hbase.security.token.ClientTokenUtil
+import org.apache.hadoop.security.Credentials
+
+import org.apache.kyuubi.{KyuubiException, Logging}
+import org.apache.kyuubi.config.KyuubiConf
+import 
org.apache.kyuubi.credentials.HadoopFsDelegationTokenProvider.doAsProxyUser
+
+private class HBaseDelegationTokenProvider
+  extends HadoopDelegationTokenProvider with Logging {
+
+  override def serviceName: String = "hbase"
+  private var tokenRequired: Boolean = _
+  private var hbaseConf: Configuration = _
+  private var kyuubiConf: KyuubiConf = _
+
+  override def initialize(hadoopConf: Configuration, kyuubiConf: KyuubiConf): 
Unit = {
+    this.kyuubiConf = kyuubiConf
+    this.hbaseConf = hadoopConf
+    this.tokenRequired = hbaseConf.get("hbase.security.authentication") == 
"kerberos"
+  }
+
+  override def obtainDelegationTokens(
+      owner: String,
+      creds: Credentials): Unit = {
+    doAsProxyUser(owner) {
+      try {
+        info(s"Getting hbase token for ${owner} ...")
+        val conn = ConnectionFactory.createConnection(hbaseConf)

Review Comment:
   @Z1Wu I think we'd better align with Spark, we can add a maven property 
`hbase.scope`, default value is `provided`, then the official release does not 
ship HBase jars, and users who use HBase can build with `-Dhbase.scope=compile`.
   
   If this approach is adopted, we must ensure it won't throw linkage issues 
without HBase jars under the Kyuubi server's classpath



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org
For additional commands, e-mail: notifications-h...@kyuubi.apache.org

Reply via email to