private static User loginFromKeytabAndReturnUser(UserProvider provider) throws IOException {
    try {
      provider.login(HBASE_CLIENT_KEYTAB_FILE, HBASE_CLIENT_KERBEROS_PRINCIPAL);
    } catch (IOException ioe) {
      LOG.error("Error while trying to login as user {} through {}, with message: {}.",
        HBASE_CLIENT_KERBEROS_PRINCIPAL, HBASE_CLIENT_KEYTAB_FILE, ioe.getMessage());
      throw ioe;
    }
    return provider.getCurrent();
  }
For kerberized cluster, return login user (from kinit or from keytab if specified). For
non-kerberized cluster, return system user.
@param conf configuartion file
@throws IOException login exception
hbase-common/src/main/java/org/apache/hadoop/hbase/AuthUtil.java