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

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/sensitive/azure/keyvault/AzureKeyVaultSensitivePropertyProvider.java
 ##########
 @@ -0,0 +1,162 @@
+/*
+ * 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.azure.keyvault;
+
+import com.microsoft.azure.credentials.ApplicationTokenCredentials;
+import com.microsoft.azure.keyvault.KeyVaultClient;
+import com.microsoft.azure.keyvault.models.KeyOperationResult;
+import com.microsoft.azure.keyvault.models.KeyVaultErrorException;
+import com.microsoft.azure.keyvault.webkey.JsonWebKeyEncryptionAlgorithm;
+import com.microsoft.azure.management.Azure;
+import com.microsoft.rest.LogLevel;
+import org.apache.commons.lang3.StringUtils;
+import 
org.apache.nifi.properties.sensitive.SensitivePropertyConfigurationException;
+import 
org.apache.nifi.properties.sensitive.SensitivePropertyProtectionException;
+import org.apache.nifi.properties.sensitive.SensitivePropertyProvider;
+import org.bouncycastle.util.encoders.Base64;
+import org.bouncycastle.util.encoders.DecoderException;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+
+// Azure with Java:
+// https://docs.microsoft.com/en-us/azure/java/?view=azure-java-stable
+
+// Azure auth with Java:
+// https://github.com/Azure/azure-libraries-for-java/blob/master/AUTH.md
+
+// Azure Key Vault with Java:
+// 
https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.keyvault?view=azure-java-stable
+
+
+public class AzureKeyVaultSensitivePropertyProvider implements 
SensitivePropertyProvider {
+    private static final String IMPLEMENTATION_NAME = "Azure Key Vault 
Sensitive Property Provider";
+    private static final String MATERIAL_PREFIX = "azure";
+    private static final String MATERIAL_KEY_TYPE = "vault";
+    private static final JsonWebKeyEncryptionAlgorithm algo = 
JsonWebKeyEncryptionAlgorithm.RSA_OAEP;
+
+    private final KeyVaultClient client;
+    private final String vaultId;
+    private final String keyId;
+
+    public AzureKeyVaultSensitivePropertyProvider(String material) {
+        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
+        try {
+            ApplicationTokenCredentials.fromFile(credFile).clientId();
+        } catch (IOException e) {
+            throw new SensitivePropertyConfigurationException(e);
+        }
+
+        String prefix = MATERIAL_PREFIX + "/" + MATERIAL_KEY_TYPE + "/";
 
 Review comment:
   Fixed.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to