Skip to content

Commit 91c87cf

Browse files
committed
add kerberos login log
1 parent 3871abf commit 91c87cf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/src/main/java/com/dtstack/flink/sql/util/KrbUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import org.apache.hadoop.conf.Configuration;
2222
import org.apache.hadoop.security.UserGroupInformation;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
2325

2426
import java.io.IOException;
2527

@@ -30,12 +32,19 @@
3032
**/
3133
public class KrbUtils {
3234

35+
private static final Logger LOG = LoggerFactory.getLogger(KrbUtils.class);
36+
3337
public static final String KRB5_CONF_KEY = "java.security.krb5.conf";
3438
public static final String HADOOP_AUTH_KEY = "hadoop.security.authentication";
3539
public static final String KRB_STR = "Kerberos";
40+
// public static final String FALSE_STR = "false";
41+
// public static final String SUBJECT_ONLY_KEY = "javax.security.auth.useSubjectCredsOnly";
3642

3743
public static UserGroupInformation getUgi(String principal, String keytabPath, String krb5confPath) throws IOException {
44+
LOG.info("Kerberos login with principal: {} and keytab: {}", principal, keytabPath);
3845
System.setProperty(KRB5_CONF_KEY, krb5confPath);
46+
// TODO 尚未探索出此选项的意义,以后研究明白方可打开
47+
// System.setProperty(SUBJECT_ONLY_KEY, FALSE_STR);
3948
Configuration configuration = new Configuration();
4049
configuration.set(HADOOP_AUTH_KEY , KRB_STR);
4150
UserGroupInformation.setConfiguration(configuration);

0 commit comments

Comments
 (0)