morningman commented on code in PR #37301:
URL: https://github.com/apache/doris/pull/37301#discussion_r1678728941
##########
fe/fe-common/src/main/java/org/apache/doris/common/Config.java:
##########
@@ -2675,6 +2675,10 @@ public class Config extends ConfigBase {
@ConfField(mutable = true)
public static boolean enable_cooldown_replica_affinity = true;
+ @ConfField(description = {"Kerberos TGT ticket缓存更新周期",
+ "Kerberos TGT ticket cache update period"})
+ public static long kerberos_tgt_cache_renew_time = 3600 * 1000L;
Review Comment:
```suggestion
public static long kerberos_tgt_cache_renew_time_sec = 3600;
```
##########
fe/fe-common/src/main/java/org/apache/doris/common/security/authentication/HadoopKerberosAuthenticator.java:
##########
@@ -0,0 +1,110 @@
+// 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.doris.common.security.authentication;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Collections;
+import java.util.Map;
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+
+public class HadoopKerberosAuthenticator implements HadoopAuthenticator {
+ private static final Logger LOG =
LogManager.getLogger(HadoopKerberosAuthenticator.class);
+ private final KerberosAuthenticationConfig config;
+ private final UserGroupInformation ugi;
+
+ public HadoopKerberosAuthenticator(KerberosAuthenticationConfig config) {
+ this.config = config;
+ try {
+ ugi = getUGI();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void initializeAuthConfig(Configuration hadoopConf) {
+
hadoopConf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
"true");
+
hadoopConf.set(CommonConfigurationKeysPublic.HADOOP_KERBEROS_KEYTAB_LOGIN_AUTORENEWAL_ENABLED,
"true");
+ synchronized (HadoopKerberosAuthenticator.class) {
+ // avoid other catalog set conf at the same time
+ UserGroupInformation.setConfiguration(hadoopConf);
+ }
+ }
+
+ @Override
+ public UserGroupInformation getUGI() throws IOException {
Review Comment:
should return `ugi` directly?
##########
fe/fe-common/src/main/java/org/apache/doris/common/security/authentication/HadoopUGI.java:
##########
@@ -30,94 +28,52 @@
public class HadoopUGI {
Review Comment:
This class can be marked as deprecated
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]