From 9150566e9915ac04ecf79cf488aa6026e5d082bf Mon Sep 17 00:00:00 2001 From: Bjoern Boettcher Date: Mon, 25 Jan 2016 09:20:11 +0000 Subject: [PATCH] Moved adding the hbase configuration in front of the security check --- .../org/apache/storm/hbase/security/AutoHBase.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/external/storm-hbase/src/main/java/org/apache/storm/hbase/security/AutoHBase.java b/external/storm-hbase/src/main/java/org/apache/storm/hbase/security/AutoHBase.java index a2ca68e96a..a926ef6b63 100644 --- a/external/storm-hbase/src/main/java/org/apache/storm/hbase/security/AutoHBase.java +++ b/external/storm-hbase/src/main/java/org/apache/storm/hbase/security/AutoHBase.java @@ -166,18 +166,20 @@ public void addTokensToUGI(Subject subject) { protected byte[] getHadoopCredentials(Map conf) { try { final Configuration hbaseConf = HBaseConfiguration.create(); + + hbaseConf.set(HBASE_KEYTAB_FILE_KEY, hbaseKeytab); + hbaseConf.set(HBASE_PRINCIPAL_KEY, hbasePrincipal); + + UserGroupInformation.setConfiguration(hbaseConf); + if(UserGroupInformation.isSecurityEnabled()) { final String topologySubmitterUser = (String) conf.get(Config.TOPOLOGY_SUBMITTER_PRINCIPAL); UserProvider provider = UserProvider.instantiate(hbaseConf); - - hbaseConf.set(HBASE_KEYTAB_FILE_KEY, hbaseKeytab); - hbaseConf.set(HBASE_PRINCIPAL_KEY, hbasePrincipal); provider.login(HBASE_KEYTAB_FILE_KEY, HBASE_PRINCIPAL_KEY, InetAddress.getLocalHost().getCanonicalHostName()); LOG.info("Logged into Hbase as principal = " + conf.get(HBASE_PRINCIPAL_KEY)); - UserGroupInformation.setConfiguration(hbaseConf); - + UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); final UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(topologySubmitterUser, ugi);