diff --git service/src/java/org/apache/hive/service/auth/AuthenticationProviderFactory.java service/src/java/org/apache/hive/service/auth/AuthenticationProviderFactory.java index c684318986..42fbc55058 100644 --- service/src/java/org/apache/hive/service/auth/AuthenticationProviderFactory.java +++ service/src/java/org/apache/hive/service/auth/AuthenticationProviderFactory.java @@ -34,6 +34,8 @@ private final String authMethod; + private final HiveConf conf = new HiveConf(); + AuthMethods(String authMethod) { this.authMethod = authMethod; } @@ -42,6 +44,10 @@ public String getAuthMethod() { return authMethod; } + public HiveConf getConf() { + return conf; + } + public static AuthMethods getValidAuthMethod(String authMethodStr) throws AuthenticationException { for (AuthMethods auth : AuthMethods.values()) { @@ -58,16 +64,16 @@ private AuthenticationProviderFactory() { public static PasswdAuthenticationProvider getAuthenticationProvider(AuthMethods authMethod) throws AuthenticationException { - return getAuthenticationProvider(authMethod, new HiveConf()); + return getAuthenticationProvider(authMethod, null); } public static PasswdAuthenticationProvider getAuthenticationProvider(AuthMethods authMethod, HiveConf conf) throws AuthenticationException { if (authMethod == AuthMethods.LDAP) { - return new LdapAuthenticationProviderImpl(conf); + return new LdapAuthenticationProviderImpl((conf == null) ? AuthMethods.LDAP.getConf() : conf); } else if (authMethod == AuthMethods.PAM) { - return new PamAuthenticationProviderImpl(conf); + return new PamAuthenticationProviderImpl((conf == null) ? AuthMethods.PAM.getConf() : conf); } else if (authMethod == AuthMethods.CUSTOM) { - return new CustomAuthenticationProviderImpl(conf); + return new CustomAuthenticationProviderImpl((conf == null) ? AuthMethods.PAM.getConf() : conf); } else if (authMethod == AuthMethods.NONE) { return new AnonymousAuthenticationProviderImpl(); } else {