File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
core/src/main/java/com/dtstack/flink/sql/util Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2020
2121import org .apache .hadoop .conf .Configuration ;
2222import org .apache .hadoop .security .UserGroupInformation ;
23+ import org .apache .hadoop .security .authentication .util .KerberosName ;
2324import org .slf4j .Logger ;
2425import org .slf4j .LoggerFactory ;
26+ import sun .security .krb5 .Config ;
27+ import sun .security .krb5 .KrbException ;
2528
2629import java .io .IOException ;
2730
@@ -43,6 +46,13 @@ public class KrbUtils {
4346 public static UserGroupInformation getUgi (String principal , String keytabPath , String krb5confPath ) throws IOException {
4447 LOG .info ("Kerberos login with principal: {} and keytab: {}" , principal , keytabPath );
4548 System .setProperty (KRB5_CONF_KEY , krb5confPath );
49+ // 不刷新会读/etc/krb5.conf
50+ try {
51+ Config .refresh ();
52+ KerberosName .resetDefaultRealm ();
53+ } catch (KrbException e ) {
54+ LOG .warn ("resetting default realm failed, current default realm will still be used." , e );
55+ }
4656 // TODO 尚未探索出此选项的意义,以后研究明白方可打开
4757// System.setProperty(SUBJECT_ONLY_KEY, FALSE_STR);
4858 Configuration configuration = new Configuration ();
You can’t perform that action at this time.
0 commit comments