You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/09/03 21:24:27 UTC

[GitHub] [nifi] natural commented on a change in pull request #3672: NIFI-6363 Additional Sensitive Property Providers

natural commented on a change in pull request #3672: NIFI-6363 Additional Sensitive Property Providers
URL: https://github.com/apache/nifi/pull/3672#discussion_r320484815
 
 

 ##########
 File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/sensitive/StandardSensitivePropertyProvider.java
 ##########
 @@ -0,0 +1,115 @@
+/*
+ * 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.properties.sensitive;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.properties.sensitive.aes.AESSensitivePropertyProvider;
+import org.apache.nifi.properties.sensitive.aws.kms.AWSKMSSensitivePropertyProvider;
+import org.apache.nifi.properties.sensitive.azure.keyvault.AzureKeyVaultSensitivePropertyProvider;
+import org.apache.nifi.properties.sensitive.gcp.kms.GCPKMSSensitivePropertyProvider;
+import org.apache.nifi.properties.sensitive.hashicorp.vault.VaultSensitivePropertyProvider;
+import org.apache.nifi.properties.sensitive.keystore.KeyStoreSensitivePropertyProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class hides the various SPP subclass construction from clients.
+ *
+ */
+public class StandardSensitivePropertyProvider {
+    private static final Logger logger = LoggerFactory.getLogger(StandardSensitivePropertyProvider.class);
+
+    /**
+     * Creates a {@link SensitivePropertyProvider} suitable for a given key or key id.
+     *
+     * If an empty or null key/key id is given, this implementation returns null.  This is a convenience
+     * for clients using the various Property classes, as those classes allow a null SensitivePropertyProvider.
+     *
+     * If no provider recognizes a key/key id, this implementation throws {@link SensitivePropertyProtectionException}.
+     *
+     * @param key provider encryption key
+     * @param scheme name of encryption or protection scheme
+     * @return concrete instance of SensitivePropertyProvider, or null when no key/key id is specified
+     * @throws SensitivePropertyProtectionException when a key/key id is not handled by any provider.
+     */
+    public static SensitivePropertyProvider fromKey(String key, String scheme) {
+        if (StringUtils.isBlank(key)) {
+            return null;
+
+            // TODO:  remove these scheme checks
 
 Review comment:
   Cleaned up; thanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services