欢迎投稿

今日深度:

hive 认证,

hive 认证,


Pluggable custom authentication: Pluggable custom authentication provides a custom authentication provider for HiveServer2. To enable it, confgure the
settings as follows:
<property>
<name>hive.server2.authentication</name>
<value>CUSTOM</value>
</property>
<property>
<name>hive.server2.custom.authentication.class</name>
<value>pluggable-auth-class-name</value>
<description> Custom authentication class name, such as
com.packtpub.hive.essentials.hiveudf.customAuthenticator
</description>
</property>



The following is a sample of a customized class that implements the org.apache.hive.service.auth.PasswdAuthenticationProvider interface.The overridde Authenticate method has the core logic of how to authenticate a username and password. Make sure to copy the compiled JAR fle to $HIVE_HOME/lib/ so that the preceding settings can work.
customAuthenticator.java
package com.packtpub.hive.essentials.hiveudf;
import java.util.Hashtable;
import javax.security.sasl.AuthenticationException;
import org.apache.hive.service.auth.PasswdAuthenticationProvider;
/*
* The customized class for HiveServer2 authentication
*/
public class customAuthenticator implements PasswdAuthenticationProvider {
Hashtable<String, String> authHashTable = null;
public customAuthenticator () {
authHashTable = new Hashtable<String, String>();
authHashTable.put("user1", "passwd1");
authHashTable.put("user2", "passwd2");
}
@Override
public void Authenticate(String user, String password) throws AuthenticationException {
String storedPasswd = authHashTable.get(user);
if (storedPasswd != null && storedPasswd.equals(password))
return;
throw new AuthenticationException("customAuthenticatorException: Invalid user");
}
}

www.htsjk.Com true http://www.htsjk.com/hive/41748.html NewsArticle hive 认证, Pluggable custom authentication : Pluggable custom authentication provides a custom authentication provider for HiveServer2. To enable it, confgure the settings as follows: property namehive.server2.authentication/name valueC...
相关文章
    暂无相关文章
评论暂时关闭