Repository: incubator-ranger Updated Branches: refs/heads/master 55c55ca7a -> ab131efd3
RANGER-1113: Ranger Hive authorizer updated to get query string from HiveConf Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/ab131efd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/ab131efd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/ab131efd Branch: refs/heads/master Commit: ab131efd32f9ba3622aef865d1fd8b0832730dcc Parents: 55c55ca Author: Madhan Neethiraj <[email protected]> Authored: Wed Jul 20 23:57:09 2016 -0700 Committer: Madhan Neethiraj <[email protected]> Committed: Wed Jul 20 23:57:09 2016 -0700 ---------------------------------------------------------------------- .../authorization/hive/authorizer/RangerHiveAuthorizer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/ab131efd/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java ---------------------------------------------------------------------- diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java index 6ef58b0..bf210e2 100644 --- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java +++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java @@ -75,6 +75,8 @@ public class RangerHiveAuthorizer extends RangerHiveAuthorizerBase { public static final String MASK_TYPE_NONE = "MASK_NONE"; public static final String MASK_TYPE_CUSTOM = "CUSTOM"; + private static final String HIVE_CONF_VAR_QUERY_STRING = "hive.query.string"; + private static volatile RangerHivePlugin hivePlugin = null ; public RangerHiveAuthorizer(HiveMetastoreClientFactory metastoreClientFactory, @@ -1129,7 +1131,12 @@ public class RangerHiveAuthorizer extends RangerHiveAuthorizerBase { if(ss != null) { ret.setClientIPAddress(ss.getUserIpAddress()); ret.setSessionId(ss.getSessionId()); - ret.setRequestData(ss.getConf().getQueryString()); + + HiveConf hiveConf = ss.getConf(); + + if(hiveConf != null) { + ret.setRequestData(hiveConf.get(HIVE_CONF_VAR_QUERY_STRING)); + } } HiveAuthzSessionContext sessionContext = getHiveAuthzSessionContext();
