private boolean loginUserHasCurrentAuthMethod(UserGroupInformation ugi, String sAuthMethod) {
    AuthenticationMethod authMethod;
    try {
      // based on SecurityUtil.getAuthenticationMethod()
      authMethod = Enum.valueOf(AuthenticationMethod.class, sAuthMethod.toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException iae) {
      throw new IllegalArgumentException("Invalid attribute value for " +
          HADOOP_SECURITY_AUTHENTICATION + " of " + sAuthMethod, iae);
    }
    LOG.debug("Current authMethod = {}", ugi.getAuthenticationMethod());
    return ugi.getAuthenticationMethod().equals(authMethod);
  }
Return true if the current login user is already using the given authMethod.

Used above to ensure we do not create a new Configuration object and as such
lose other settings such as the cluster to which the JVM is connected. Required
for oozie since it does not have a core-site.xml see HIVE-7682
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/security/HadoopThriftAuthBridge.java