sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ak...@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 Sat, 11 Mar 2017 02:13:11 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign df7c7dd40 -> f6d31428f


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/f6d31428
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/f6d31428
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/f6d31428

Branch: refs/heads/sentry-ha-redesign
Commit: f6d31428fc6013528002c586f2d3cf21d27a70f5
Parents: df7c7dd
Author: Alexander Kolbasov <akolb@cloudera.com>
Authored: Fri Mar 10 18:13:06 2017 -0800
Committer: Alexander Kolbasov <akolb@cloudera.com>
Committed: Fri Mar 10 18:13:06 2017 -0800

----------------------------------------------------------------------
 .../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/f6d31428/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 cc5194b..4851114 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/f6d31428/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 74fe421..54ac2be 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.provider.file.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