private static User loginClientAsService(Configuration conf) throws IOException {
    UserProvider provider = UserProvider.instantiate(conf);
    if (provider.isHBaseSecurityEnabled() && provider.isHadoopSecurityEnabled()) {
      try {
        if (provider.shouldLoginFromKeytab()) {
          String host = Strings.domainNamePointerToHostName(
            DNS.getDefaultHost(conf.get("hbase.client.dns.interface", "default"),
              conf.get("hbase.client.dns.nameserver", "default")));
          provider.login(HBASE_CLIENT_KEYTAB_FILE, HBASE_CLIENT_KERBEROS_PRINCIPAL, host);
        }
      } catch (UnknownHostException e) {
        LOG.error("Error resolving host name: " + e.getMessage(), e);
        throw e;
      } catch (IOException e) {
        LOG.error("Error while trying to perform the initial login: " + e.getMessage(), e);
        throw e;
      }
    }
    return provider.getCurrent();
  }
For kerberized cluster, return login user (from kinit or from keytab). Principal should be the
following format: name/fully.qualified.domain.name@REALM. For non-kerberized cluster, return
system user.
<p>
NOT recommend to use to method unless you're sure what you're doing, it is for canary only.
Please use User#loginClient.
@param conf configuration file
@throws IOException login exception
hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java