配置
在 hive-site.xml 中加
hive.server2.authentication
CUSTOM
hive.server2.custom.authentication.class
org.apache.hadoop.hive.contrib.auth.XXXXPasswdAuthenticator
设置 server2 验证方式是 CUSTOM;并指定自定义验证类是 org.apache.hadoop.hive.contrib.auth.XXXXPasswdAuthenticator。
完成自定义验证类 org.apache.hadoop.hive.contrib.auth.XXXXPasswdAuthenticator,继承 org.apache.hive.service.auth.PasswdAuthenticationProvider。
重写方法,如下:
@Override
public void Authenticate(String userName, String passwd) throws AuthenticationException
{
LOG.info("user: " + userName + " try login.");
String passwdMD5 = getConf().get(String.format(HIVE_JDBC_PASSWD_AUTH_PREFIX, userName));
if (passwdMD5 == null)
{
String message = "user's ACL configration is not found. user:"