sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject sentry git commit: SENTRY-1450: Have privilege converter set by Kafka binding (Ashish K Singh, Reviewed by: Hao Hao and Dapeng Sun)
Date Thu, 25 Aug 2016 23:40:45 GMT
Repository: sentry
Updated Branches:
  refs/heads/master 53dc2d6f4 -> df2b27364


SENTRY-1450: Have privilege converter set by Kafka binding (Ashish K Singh, Reviewed by: Hao
Hao and Dapeng Sun)


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/df2b2736
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/df2b2736
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/df2b2736

Branch: refs/heads/master
Commit: df2b27364753cf146d34d912ff9d9037c4cca9aa
Parents: 53dc2d6
Author: hahao <hao.hao@cloudera.com>
Authored: Thu Aug 25 16:39:37 2016 -0700
Committer: hahao <hao.hao@cloudera.com>
Committed: Thu Aug 25 16:39:37 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java | 6 ++++++
 .../sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java    | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/df2b2736/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
b/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
index 53e7a3c..5fc4a5c 100644
--- a/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
+++ b/sentry-binding/sentry-binding-kafka/src/main/java/org/apache/sentry/kafka/binding/KafkaAuthBinding.java
@@ -61,6 +61,7 @@ import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericService
 import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
 import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
 import org.apache.sentry.provider.db.generic.service.thrift.TSentryRole;
+import org.apache.sentry.provider.db.generic.tools.KafkaTSentryPrivilegeConverter;
 import org.apache.sentry.service.thrift.ServiceConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -153,6 +154,11 @@ public class KafkaAuthBinding {
               " are required configs to be able to initialize Kerberos");
     }
 
+    // for convenience, set the PrivilegeConverter.
+    if (authConf.get(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER) == null) {
+      authConf.set(ServiceConstants.ClientConfig.PRIVILEGE_CONVERTER, KafkaTSentryPrivilegeConverter.class.getName());
+    }
+
     // Instantiate the configured providerBackend
     Constructor<?> providerBackendConstructor =
         Class.forName(providerBackendName)

http://git-wip-us.apache.org/repos/asf/sentry/blob/df2b2736/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
b/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
index 10d6af7..02d51c0 100644
--- a/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
+++ b/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
@@ -32,7 +32,6 @@ import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericService
 import org.apache.sentry.provider.db.generic.service.thrift.SentryGenericServiceClientFactory;
 import org.apache.sentry.provider.db.generic.service.thrift.TAuthorizable;
 import org.apache.sentry.provider.db.generic.service.thrift.TSentryPrivilege;
-import org.apache.sentry.provider.db.generic.tools.KafkaTSentryPrivilegeConverter;
 import org.apache.sentry.provider.file.LocalGroupResourceAuthorizationProvider;
 import org.apache.sentry.core.common.utils.PolicyFile;
 import org.apache.sentry.service.thrift.SentryService;
@@ -217,7 +216,6 @@ public class AbstractKafkaSentryTestBase {
     conf.set(KafkaAuthConf.AuthzConfVars.AUTHZ_PROVIDER_RESOURCE.getVar(), policyFilePath.getPath());
     conf.setBoolean(ClientConfig.ENABLE_CACHING, true);
     conf.setLong(ClientConfig.CACHE_TTL_MS, CACHE_TTL_MS);
-    conf.set(ClientConfig.PRIVILEGE_CONVERTER, KafkaTSentryPrivilegeConverter.class.getName());
     return conf;
   }
 


Mime
View raw message