Repository: nifi
Updated Branches:
  refs/heads/master 9c9215982 -> 0b0aebe14


http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/pom.xml
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/pom.xml
 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/pom.xml
new file mode 100644
index 0000000..6cedafc
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/pom.xml
@@ -0,0 +1,36 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements. See the NOTICE file distributed with 
this
+        work for additional information regarding copyright ownership. The ASF 
licenses
+        this file to You under the Apache License, Version 2.0 (the 
"License"); you
+        may not use this file except in compliance with the License. You may 
obtain
+        a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
Unless
+        required by applicable law or agreed to in writing, software 
distributed
+        under the License is distributed on an "AS IS" BASIS, WITHOUT 
WARRANTIES
+        OR CONDITIONS OF ANY KIND, either express or implied. See the License 
for
+        the specific language governing permissions and limitations under the 
License. -->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-kerberos-credentials-service-bundle</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>nifi-kerberos-credentials-service</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-kerberos-credentials-service-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-utils</artifactId>
+            <version>1.6.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/java/org/apache/nifi/kerberos/KeytabCredentialsService.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/java/org/apache/nifi/kerberos/KeytabCredentialsService.java
 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/java/org/apache/nifi/kerberos/KeytabCredentialsService.java
new file mode 100644
index 0000000..14dd784
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/java/org/apache/nifi/kerberos/KeytabCredentialsService.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.kerberos;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.nifi.annotation.behavior.Restricted;
+import org.apache.nifi.annotation.behavior.Restriction;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.RequiredPermission;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.controller.ControllerServiceInitializationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
+
+@CapabilityDescription("Provides a mechanism for specifying a Keytab and a 
Principal that other components are able to use in order to "
+    + "perform authentication using Kerberos. By encapsulating this 
information into a Controller Service and allowing other components to make use 
of it "
+    + "(as opposed to specifying the principal and keytab directly in the 
processor) an administrative is able to choose which users are allowed to "
+    + "use which keytabs and principals. This provides a more robust security 
model for multi-tenant use cases.")
+@Tags({"Kerberos", "Keytab", "Principal", "Credentials", "Authentication", 
"Security"})
+@Restricted(restrictions = {
+    @Restriction(requiredPermission = RequiredPermission.ACCESS_KEYTAB, 
explanation = "Allows user to define a Keytab and principal that can then be 
used by other components.")
+})
+public class KeytabCredentialsService extends AbstractControllerService 
implements KerberosCredentialsService {
+
+    static final PropertyDescriptor PRINCIPAL = new 
PropertyDescriptor.Builder()
+        .name("Kerberos Principal")
+        .description("Kerberos principal to authenticate as. Requires 
nifi.kerberos.krb5.file to be set in your nifi.properties")
+        .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+        .expressionLanguageSupported(true)
+        .required(true)
+        .build();
+
+    static final PropertyDescriptor KEYTAB = new PropertyDescriptor.Builder()
+        .name("Kerberos Keytab")
+        .description("Kerberos keytab associated with the principal. Requires 
nifi.kerberos.krb5.file to be set in your nifi.properties")
+        .addValidator(StandardValidators.FILE_EXISTS_VALIDATOR)
+        .expressionLanguageSupported(true)
+        .required(true)
+        .build();
+
+    private File kerberosConfigFile;
+    private volatile String principal;
+    private volatile String keytab;
+
+    @Override
+    protected final void init(final ControllerServiceInitializationContext 
config) throws InitializationException {
+        kerberosConfigFile = config.getKerberosConfigurationFile();
+    }
+
+    @Override
+    protected Collection<ValidationResult> customValidate(final 
ValidationContext validationContext) {
+        final List<ValidationResult> results = new ArrayList<>();
+
+        // Check that the Kerberos configuration is set
+        if (kerberosConfigFile == null) {
+            results.add(new ValidationResult.Builder()
+                .subject("Kerberos Configuration File")
+                .valid(false)
+                .explanation("The nifi.kerberos.krb5.file property must be set 
in nifi.properties in order to use Kerberos authentication")
+                .build());
+        } else if (!kerberosConfigFile.canRead()) {
+            // Check that the Kerberos configuration is readable
+            results.add(new ValidationResult.Builder()
+                .subject("Kerberos Configuration File")
+                .valid(false)
+                .explanation("Unable to read configured Kerberos Configuration 
File " + kerberosConfigFile.getAbsolutePath() + ", which is specified in 
nifi.properties. "
+                    + "Please ensure that the path is valid and that NiFi has 
adequate permissions to read the file.")
+                .build());
+        }
+
+        return results;
+    }
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        final List<PropertyDescriptor> properties = new ArrayList<>(2);
+        properties.add(KEYTAB);
+        properties.add(PRINCIPAL);
+        return properties;
+    }
+
+    @OnEnabled
+    public void setConfiguredValues(final ConfigurationContext context) {
+        this.keytab = 
context.getProperty(KEYTAB).evaluateAttributeExpressions().getValue();
+        this.principal = 
context.getProperty(PRINCIPAL).evaluateAttributeExpressions().getValue();
+    }
+
+    @Override
+    public String getKeytab() {
+        return keytab;
+    }
+
+    @Override
+    public String getPrincipal() {
+        return principal;
+    }
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService
 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService
new file mode 100644
index 0000000..10d4ecd
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/nifi-kerberos-credentials-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+org.apache.nifi.kerberos.KeytabCredentialsService
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/pom.xml
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/pom.xml
 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/pom.xml
new file mode 100644
index 0000000..87c2a38
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-kerberos-credentials-service-bundle/pom.xml
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <!--
+      Licensed to the Apache Software Foundation (ASF) under one or more
+      contributor license agreements.  See the NOTICE file distributed with
+      this work for additional information regarding copyright ownership.
+      The ASF licenses this file to You under the Apache License, Version 2.0
+      (the "License"); you may not use this file except in compliance with
+      the License.  You may obtain a copy of the License at
+          http://www.apache.org/licenses/LICENSE-2.0
+      Unless required by applicable law or agreed to in writing, software
+      distributed under the License is distributed on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      See the License for the specific language governing permissions and
+      limitations under the License.
+    -->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-standard-services</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>nifi-kerberos-credentials-service-bundle</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>nifi-kerberos-credentials-service</module>
+        <module>nifi-kerberos-credentials-service-nar</module>
+    </modules>
+</project>

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml
 
b/nifi-nar-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml
index 7046e70..ab5714d 100644
--- 
a/nifi-nar-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-standard-services-api-nar/pom.xml
@@ -83,5 +83,10 @@
             <artifactId>nifi-record</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-kerberos-credentials-service-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/nifi-standard-services/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-services/pom.xml 
b/nifi-nar-bundles/nifi-standard-services/pom.xml
index b6bedaf..fb6c4d5 100644
--- a/nifi-nar-bundles/nifi-standard-services/pom.xml
+++ b/nifi-nar-bundles/nifi-standard-services/pom.xml
@@ -43,5 +43,7 @@
         <module>nifi-hwx-schema-registry-bundle</module>
         <module>nifi-mongodb-client-service-api</module>
         <module>nifi-mongodb-services-bundle</module>
+        <module>nifi-kerberos-credentials-service-api</module>
+        <module>nifi-kerberos-credentials-service-bundle</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/nifi-nar-bundles/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/pom.xml b/nifi-nar-bundles/pom.xml
index a1d6eac..fa12c8b 100755
--- a/nifi-nar-bundles/pom.xml
+++ b/nifi-nar-bundles/pom.xml
@@ -209,6 +209,12 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-kerberos-credentials-service-api</artifactId>
+                <version>1.6.0-SNAPSHOT</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.nifi</groupId>
                 <artifactId>nifi-mongodb-client-service-api</artifactId>
                 <version>1.6.0-SNAPSHOT</version>
                 <scope>provided</scope>

http://git-wip-us.apache.org/repos/asf/nifi/blob/0b0aebe1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8c19256..7088100 100644
--- a/pom.xml
+++ b/pom.xml
@@ -286,7 +286,6 @@
                 <version>${jetty.version}</version>
                 <scope>provided</scope>
             </dependency>
-
         </dependencies>
     </dependencyManagement>
 

Reply via email to