public static PasswdAuthenticationProvider getAuthenticationProvider(AuthMethods authMethod, HiveConf conf)
    throws AuthenticationException {
    if (authMethod == AuthMethods.LDAP) {
      return new LdapAuthenticationProviderImpl((conf == null) ? AuthMethods.LDAP.getConf() : conf);
    } else if (authMethod == AuthMethods.PAM) {
      return new PamAuthenticationProviderImpl((conf == null) ? AuthMethods.PAM.getConf() : conf);
    } else if (authMethod == AuthMethods.CUSTOM) {
      return new CustomAuthenticationProviderImpl((conf == null) ? AuthMethods.CUSTOM.getConf() : conf);
    } else if (authMethod == AuthMethods.NONE) {
      return new AnonymousAuthenticationProviderImpl();
    } else {
      throw new AuthenticationException("Unsupported authentication method");
    }
  }
This class helps select a {@link PasswdAuthenticationProvider} for a given {@code AuthMethod}.
service/src/java/org/apache/hive/service/auth/AuthenticationProviderFactory.java