alopresto commented on a change in pull request #3542: NIFI-6363 Integrates AWS 
KMS SPP.  Refactors SSPP.
URL: https://github.com/apache/nifi/pull/3542#discussion_r296363703
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/spring/LoginIdentityProviderFactoryBean.java
 ##########
 @@ -219,16 +217,14 @@ private LoginIdentityProviderConfigurationContext 
loadLoginIdentityProviderConfi
     }
 
     private String decryptValue(String cipherText, String encryptionScheme) 
throws SensitivePropertyProtectionException {
-            initializeSensitivePropertyProvider(encryptionScheme);
+        initializeSensitivePropertyProvider(encryptionScheme);
         return SENSITIVE_PROPERTY_PROVIDER.unprotect(cipherText);
     }
 
     private static void initializeSensitivePropertyProvider(String 
encryptionScheme) throws SensitivePropertyProtectionException {
-        if (SENSITIVE_PROPERTY_PROVIDER == null || 
!SENSITIVE_PROPERTY_PROVIDER.getIdentifierKey().equalsIgnoreCase(encryptionScheme))
 {
+        if (SENSITIVE_PROPERTY_PROVIDER == null) {
             try {
-                String keyHex = getMasterKey();
-                SENSITIVE_PROPERTY_PROVIDER_FACTORY = new 
AESSensitivePropertyProviderFactory(keyHex);
-                SENSITIVE_PROPERTY_PROVIDER = 
SENSITIVE_PROPERTY_PROVIDER_FACTORY.getProvider();
+                SENSITIVE_PROPERTY_PROVIDER = 
StandardSensitivePropertyProvider.fromKey(getMasterKey(), encryptionScheme);
 
 Review comment:
   May need to write test cases around a `login-identity-providers.xml` file 
with the AWS KMS key ID embedded in the `encryption="..."` attribute of the 
individual encrypted elements. (Possibly as subtask; requires new Jira). 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to