mirror of https://github.com/apache/nifi.git
NIFI-6847 - fixed NPE in TLS toolkit when used in client mode with SANs (#3871)
This commit is contained in:
parent
a9db5a8cb7
commit
481f9f67bf
|
@ -72,14 +72,23 @@ public class InstanceDefinition {
|
|||
|
||||
protected static InstanceDefinition createDefinition(InstanceIdentifier instanceIdentifier, int number, Supplier<String> keyStorePasswords, Supplier<String> keyPasswords,
|
||||
Supplier<String> trustStorePasswords) {
|
||||
String keyStorePassword = keyStorePasswords.get();
|
||||
String keyStorePassword = null;
|
||||
if (keyStorePasswords != null) {
|
||||
keyStorePassword = keyStorePasswords.get();
|
||||
}
|
||||
|
||||
String keyPassword;
|
||||
if (keyPasswords == null) {
|
||||
keyPassword = keyStorePassword;
|
||||
} else {
|
||||
keyPassword = keyPasswords.get();
|
||||
}
|
||||
String trustStorePassword = trustStorePasswords.get();
|
||||
|
||||
String trustStorePassword = null;
|
||||
if (trustStorePasswords != null) {
|
||||
trustStorePassword = trustStorePasswords.get();
|
||||
}
|
||||
|
||||
return new InstanceDefinition(instanceIdentifier, number, keyStorePassword, keyPassword, trustStorePassword);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,4 +175,11 @@ public class TlsCertificateAuthorityClientCommandLineTest {
|
|||
tlsCertificateAuthorityClientCommandLine.parse("-t", testToken, "-C", testCertificateFile);
|
||||
assertEquals(testCertificateFile, tlsCertificateAuthorityClientCommandLine.getCertificateDirectory());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigClientSAN() throws CommandLineParseException {
|
||||
tlsCertificateAuthorityClientCommandLine.parse("-t", testToken, "--" + TlsCertificateAuthorityClientCommandLine.SUBJECT_ALTERNATIVE_NAMES, "nifi.apache.org,minifi.apache.org");
|
||||
assertEquals("nifi.apache.org", tlsCertificateAuthorityClientCommandLine.getDomainAlternativeNames().get(0));
|
||||
assertEquals("minifi.apache.org", tlsCertificateAuthorityClientCommandLine.getDomainAlternativeNames().get(1));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue