In essence, you must provide a Java application that can perform your authentication. Perhaps you are connecting to mysql or postgres database or flat file, etc. You need to provide a bank that can implement the org.apache.hive.service.auth.PasswdAuthenticationProvider interface.
A simple example:
package org.apache.hive.service.auth.PasswdAuthenticationProvider.SampleAuth; import java.util.Hashtable; import javax.security.sasl.AuthenticationException; import org.apache.hive.service.auth.PasswdAuthenticationProvider; public class SampleAuthenticator implements PasswdAuthenticationProvider { Hashtable<String, String> store = null; public SampleAuthenticator () { store = new Hashtable<String, String>(); store.put("user1", "passwd1"); store.put("user2", "passwd2"); } @Override public void Authenticate(String user, String password) throws AuthenticationException { String storedPasswd = store.get(user); if (storedPasswd != null && storedPasswd.equals(password)) return; throw new AuthenticationException("SampleAuthenticator: Error validating user"); } }
And then in hive-site.xml use the newly created authentication jar:
<property> <name>hive.server2.authentication</name> <value>CUSTOM</value> </property> <property> <name>hive.server2.custom.authentication.class</name> <value>org.apache.hive.service.auth.PasswdAuthenticationProvider.SampleAuth</value> </property>
source share