gresockj commented on a change in pull request #4986:
URL: https://github.com/apache/nifi/pull/4986#discussion_r613465911
##########
File path:
nifi-commons/nifi-security-utils/src/main/java/org/apache/nifi/security/util/StandardTlsConfiguration.java
##########
@@ -203,6 +205,38 @@ public static StandardTlsConfiguration
fromNiFiProperties(NiFiProperties niFiPro
return tlsConfiguration;
}
+ /**
+ * Returns a {@link org.apache.nifi.security.util.TlsConfiguration}
instantiated from the relevant {@link NiFiProperties} properties.
+ *
+ * @param niFiProperties the NiFi properties, as a simple
java.util.Properties object
+ * @return a populated TlsConfiguration container object
+ */
+ public static StandardTlsConfiguration fromNiFiProperties(Properties
niFiProperties) {
+ if (niFiProperties == null) {
+ throw new IllegalArgumentException("The NiFi properties cannot be
null");
+ }
+
+ String keystorePath =
niFiProperties.getProperty(NiFiProperties.SECURITY_KEYSTORE);
+ String keystorePassword =
niFiProperties.getProperty(NiFiProperties.SECURITY_KEYSTORE_PASSWD);
+ String keyPassword =
niFiProperties.getProperty(NiFiProperties.SECURITY_KEY_PASSWD);
+ String keystoreType =
niFiProperties.getProperty(NiFiProperties.SECURITY_KEYSTORE_TYPE);
+ String truststorePath =
niFiProperties.getProperty(NiFiProperties.SECURITY_TRUSTSTORE);
+ String truststorePassword =
niFiProperties.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_PASSWD);
+ String truststoreType =
niFiProperties.getProperty(NiFiProperties.SECURITY_TRUSTSTORE_TYPE);
+ String protocol = TLS_PROTOCOL_VERSION;
+
+ final StandardTlsConfiguration tlsConfiguration = new
StandardTlsConfiguration(keystorePath, keystorePassword, keyPassword,
+ keystoreType, truststorePath, truststorePassword,
+ truststoreType, protocol);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Instantiating TlsConfiguration from NiFi properties:
{}, {}, {}, {}, {}, {}, {}, {}",
+ keystorePath,
tlsConfiguration.getKeystorePasswordForLogging(),
tlsConfiguration.getKeyPasswordForLogging(), keystoreType,
+ truststorePath,
tlsConfiguration.getTruststorePasswordForLogging(), truststoreType, protocol);
+ }
Review comment:
That said, I certainly don't need it in the new method, so I'll remove
it.
--
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]