NIFI-2923 Added evaluation of attribute expressions for Kerberos principal and keytab
Signed-off-by: Bryan Bende <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/59a32948 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/59a32948 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/59a32948 Branch: refs/heads/master Commit: 59a32948ea9ad4f1e8018ff07e994320c966ac0b Parents: 86fa1bb Author: Maurizio Colleluori <[email protected]> Authored: Mon Nov 7 17:11:59 2016 +0100 Committer: Bryan Bende <[email protected]> Committed: Wed Jun 21 17:14:28 2017 -0400 ---------------------------------------------------------------------- .../nifi/processors/hadoop/AbstractHadoopProcessor.java | 8 ++++---- .../java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java | 8 ++++---- .../org/apache/nifi/processors/hive/PutHiveStreaming.java | 4 ++-- .../org/apache/nifi/hbase/HBase_1_1_2_ClientService.java | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/59a32948/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java index 9f99500..d88f774 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java @@ -148,8 +148,8 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final String configResources = validationContext.getProperty(HADOOP_CONFIGURATION_RESOURCES).getValue(); - final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); final List<ValidationResult> results = new ArrayList<>(); @@ -262,8 +262,8 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor { UserGroupInformation ugi; synchronized (RESOURCES_LOCK) { if (SecurityUtil.isSecurityEnabled(config)) { - String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); ugi = SecurityUtil.loginKerberos(config, principal, keyTab); fs = getFileSystemAsUser(config, ugi); lastKerberosReloginTime = System.currentTimeMillis() / 1000; http://git-wip-us.apache.org/repos/asf/nifi/blob/59a32948/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java index bdf2f10..c6941d3 100644 --- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java +++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java @@ -190,8 +190,8 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv if (confFileProvided) { final String configFiles = validationContext.getProperty(HIVE_CONFIGURATION_RESOURCES).evaluateAttributeExpressions().getValue(); - final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - final String keyTab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + final String keyTab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); problems.addAll(hiveConfigurator.validate(configFiles, principal, keyTab, validationResourceHolder, getLogger())); } @@ -229,8 +229,8 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv final String drv = HiveDriver.class.getName(); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { - final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{principal, keyTab}); try { http://git-wip-us.apache.org/repos/asf/nifi/blob/59a32948/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java index f08310e..fe677e5 100644 --- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java +++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java @@ -349,8 +349,8 @@ public class PutHiveStreaming extends AbstractSessionFactoryProcessor { hiveConfigurator.preload(hiveConfig); if (SecurityUtil.isSecurityEnabled(hiveConfig)) { - final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{principal, keyTab}); try { http://git-wip-us.apache.org/repos/asf/nifi/blob/59a32948/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java index fa71d06..2d1166c 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java +++ b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientService.java @@ -167,8 +167,8 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme } final Configuration hbaseConfig = resources.getConfiguration(); - final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); problems.addAll(KerberosProperties.validatePrincipalAndKeytab( this.getClass().getSimpleName(), hbaseConfig, principal, keytab, getLogger())); @@ -223,8 +223,8 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme } if (SecurityUtil.isSecurityEnabled(hbaseConfig)) { - final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue(); - final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue(); + final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue(); + final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue(); getLogger().info("HBase Security Enabled, logging in as principal {} with keytab {}", new Object[] {principal, keyTab}); ugi = SecurityUtil.loginKerberos(hbaseConfig, principal, keyTab);
