You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Amithsha (JIRA)" <ji...@apache.org> on 2014/12/01 11:34:12 UTC

[jira] [Created] (HIVE-8999) hiveserver2 CUSTOM authentication Fails

Amithsha created HIVE-8999:
------------------------------

             Summary: hiveserver2 CUSTOM authentication Fails
                 Key: HIVE-8999
                 URL: https://issues.apache.org/jira/browse/HIVE-8999
             Project: Hive
          Issue Type: Bug
          Components: Beeline, HiveServer2
    Affects Versions: 0.14.0
         Environment: Centos 6.5 Hadoop 2.4.1 Hive 0.14.0
            Reporter: Amithsha


Planned to secure the hiverserver2 Using Custom authentication Method. 
But when the beeline starts and sets the server Ip and port using command. It hanges in the terminal after providing the username and Password.
******************************Procedure Followed************************************
*Compiled Java File to create a jar
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");
  }

}
---------------------------------------------------------------------------------------------
*Properties Used in Hive-site.xml
<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>
--------------------------------------------------------------------------
*Started Beeline 
beeline> !connect jdbc:hive2://localhost:10000/default
scan complete in 13ms
Connecting to jdbc:hive2://localhost:10000/default
Enter username for jdbc:hive2://localhost:10000/default: user1
Enter password for jdbc:hive2://localhost:10000/default: *******
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-hive/lib/hive-jdbc-0.14.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
------------------------------------------------------------------------------------------
Can Anyone help me by providing the correct Java file and Procedures to use Custom Authentication
Thank you
Amithsha.S



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)