Repository: incubator-sentry Updated Branches: refs/heads/master d6b1eb6e8 -> c092f7dfe
SENTRY-362: When sentry integrate into solr, the create instance of backend needs configure parameters from solrAuthzConf not hadoopConf (guoquanshen via Gregory Chanan) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/c092f7df Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/c092f7df Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/c092f7df Branch: refs/heads/master Commit: c092f7dfe767d1a8cb5e79ee7b66b37190b98c7f Parents: d6b1eb6 Author: Gregory Chanan <[email protected]> Authored: Mon Jul 28 13:24:32 2014 -0700 Committer: Gregory Chanan <[email protected]> Committed: Mon Jul 28 15:03:28 2014 -0700 ---------------------------------------------------------------------- .../apache/sentry/binding/solr/authz/SolrAuthzBinding.java | 8 +++----- .../org/apache/sentry/binding/solr/conf/SolrAuthzConf.java | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c092f7df/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java index 5e85606..c384cd1 100644 --- a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java +++ b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/authz/SolrAuthzBinding.java @@ -59,7 +59,7 @@ public class SolrAuthzBinding { private ProviderBackend providerBackend; public SolrAuthzBinding (SolrAuthzConf authzConf) throws Exception { - this.authzConf = authzConf; + this.authzConf = addHdfsPropsToConf(authzConf); this.authProvider = getAuthProvider(); this.groupMapping = authProvider.getGroupMapping(); } @@ -86,9 +86,8 @@ public class SolrAuthzBinding { if (kerberosEnabledProp.equalsIgnoreCase("true")) { initKerberos(keytabProp, principalProp); } - Configuration conf = getConf(); providerBackend = - (ProviderBackend) providerBackendConstructor.newInstance(new Object[] {conf, resourceName}); + (ProviderBackend) providerBackendConstructor.newInstance(new Object[] {authzConf, resourceName}); // load the policy engine class Constructor<?> policyConstructor = @@ -147,8 +146,7 @@ public class SolrAuthzBinding { return providerBackend.getRoles(getGroups(user), ActiveRoleSet.ALL); } - private Configuration getConf() throws IOException { - Configuration conf = new Configuration(); + private SolrAuthzConf addHdfsPropsToConf(SolrAuthzConf conf) throws IOException { String confDir = System.getProperty("solr.hdfs.confdir"); if (confDir != null && confDir.length() > 0) { File confDirFile = new File(confDir); http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c092f7df/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/conf/SolrAuthzConf.java ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/conf/SolrAuthzConf.java b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/conf/SolrAuthzConf.java index 2d7bae8..227f75e 100644 --- a/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/conf/SolrAuthzConf.java +++ b/sentry-binding/sentry-binding-solr/src/main/java/org/apache/sentry/binding/solr/conf/SolrAuthzConf.java @@ -67,7 +67,7 @@ public class SolrAuthzConf extends Configuration { public static final String AUTHZ_SITE_FILE = "sentry-site.xml"; public SolrAuthzConf(URL solrAuthzSiteURL) { - super(false); + super(true); addResource(solrAuthzSiteURL); }
