private boolean isKerberosEnabled(Configuration conf) {
    try {
      return UserGroupInformation.getLoginUser().isFromKeytab() &&
          MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.THRIFT_ZOOKEEPER_USE_KERBEROS);
    } catch (IOException e) {
      return false;
    }
  }
Check if Kerberos authentication is enabled.
This is used by:
- HMS
In secure scenarios the HMS is logged in (by itself) using Kerberos keytab, hence
UGI.getLoginUser().isFromKeytab() returns true.
This makes checking against this method the tightest setting we can check against.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/security/ZooKeeperTokenStore.java