You can use a database, store the users records in there and lookup the username/password from there using a simple JDBC. For example you maybe able to use the same database that is keeping Hive metadata, mysql or postgres typically.
On Fri, Nov 28, 2014 at 8:55 PM, prasad bezavada <prasadbezav...@gmail.com> wrote: > Thank you so much for your reply .I already tried this custom/pluggable > authentication , i have implemented a PasswdAuthenticationProvider class > that validates the given username and password while connecting to hive > from java program,but here the list of usernames and password I saved in > one property file kind of file , when ever i want to connect to hive it > just checks that the given username & password with the entries in that > property file, if entry is there then it will allow us to connect otherwise > throws an error. And if we want to add an user simply we can add an user in > that property file.But I don't want to use this property file or anything > ,I just want to do it dynamically .Is there any way to do that ?Like we do > entries in LDAP. Please Let me know.. > > On Fri, Nov 28, 2014 at 10:49 PM, Peyman Mohajerian <mohaj...@gmail.com> > wrote: > >> If you don't want to deal with LDAP, I know of one other way: >> >> <property> >> >> <name>hive.server2.authentication</name> >> >> <value>CUSTOM</value> >> >> </property> >> >> <property> >> >> <name>hive.server2.custom.authentication.class</name> >> >> <value>xxxx</value> >> >> </property> >> >> You can implement: PasswdAuthenticationProvider and you put your >> implementation class in (xxx). I think these guy have some examples: >> >> from http://shiro.apache.org/ >> <http://shiro.apache.org/download.html#latestBinary> >> >> But I haven't looked into it myself. >> >> >> >> >> >> >> On Fri, Nov 28, 2014 at 5:05 AM, prasad bezavada < >> prasadbezav...@gmail.com> wrote: >> >>> Hi , >>> >>> >>> I am writing a java program to connect with hive and query the >>> data from hive. From my program i am connecting to hive as follows >>> private static String driverName = >>> "org.apache.hadoop.hive.jdbc.HiveDriver"; >>> public static void main(String[] args) throws SQLException { >>> try { >>> Class.forName(driverName); >>> } catch (ClassNotFoundException e) { >>> // TODO Auto-generated catch block >>> e.printStackTrace(); >>> System.exit(1); >>> } >>> Connection con = DriverManager.getConnection( >>> "jdbc:hive://localhost:10000/default", "hive", "any"); >>> Statement stmt = con.createStatement(); >>> .... >>> My Problem is, the above connection is not taking the password ,i >>> mean with any username and password it is allowing me to connect and ge >>> get the data from hive. But I want to restrict this and want to >>> provide security so that >>> only the specified user would be able to connect and query hive. >>> I tried :pluggable authentication and its working fine. >>> But i want to do it dynamically. >>> i don't want to use LDAP or Kerberos. >>> >>> is there any way to do that? >>> >>> and can we create users and roles in hive >>> ?if possible then how? >>> when i use the command create role role_name its giving error i.e >>> something like hive authorization incomplete or disabled >>> >>> >>> >>> >>> >> >