Search in sources :

Example 1 with StandaloneConfig

use of org.apache.nifi.toolkit.tls.configuration.StandaloneConfig in project nifi by apache.

the class TlsToolkitStandaloneCommandLine method createConfig.

/**
 * Creates the StandaloneConfig for use in running TlsToolkitStandalone
 *
 * @return the StandaloneConfig for use in running TlsToolkitStandalone
 */
public StandaloneConfig createConfig() {
    StandaloneConfig standaloneConfig = new StandaloneConfig();
    standaloneConfig.setBaseDir(baseDir);
    standaloneConfig.setNiFiPropertiesWriterFactory(niFiPropertiesWriterFactory);
    standaloneConfig.setInstanceDefinitions(instanceDefinitions);
    standaloneConfig.setOverwrite(overwrite);
    standaloneConfig.setClientDns(clientDns);
    standaloneConfig.setClientPasswords(clientPasswords);
    standaloneConfig.setClientPasswordsGenerated(clientPasswordsGenerated);
    standaloneConfig.setCaHostname(getCertificateAuthorityHostname());
    standaloneConfig.setKeyStore("nifi-ca-" + KEYSTORE + getKeyStoreType().toLowerCase());
    standaloneConfig.setKeyStoreType(getKeyStoreType());
    standaloneConfig.setKeySize(getKeySize());
    standaloneConfig.setKeyPairAlgorithm(getKeyAlgorithm());
    standaloneConfig.setSigningAlgorithm(getSigningAlgorithm());
    standaloneConfig.setDays(getDays());
    standaloneConfig.setDnPrefix(dnPrefix);
    standaloneConfig.setDnSuffix(dnSuffix);
    standaloneConfig.setDomainAlternativeNames(domainAlternativeNames);
    standaloneConfig.initDefaults();
    return standaloneConfig;
}
Also used : StandaloneConfig(org.apache.nifi.toolkit.tls.configuration.StandaloneConfig)

Example 2 with StandaloneConfig

use of org.apache.nifi.toolkit.tls.configuration.StandaloneConfig in project nifi by apache.

the class TlsToolkitStandaloneCommandLineTest method testClientPasswordMulti.

@Test
public void testClientPasswordMulti() throws CommandLineParseException {
    String testCn = "OU=NIFI,CN=testuser";
    String testCn2 = "OU=NIFI,CN=testuser2";
    String testPass1 = "testPass1";
    String testPass2 = "testPass2";
    tlsToolkitStandaloneCommandLine.parse("-C", testCn, "-C", testCn2, "-B", testPass1, "-B", testPass2);
    StandaloneConfig standaloneConfig = tlsToolkitStandaloneCommandLine.createConfig();
    List<String> clientDns = standaloneConfig.getClientDns();
    assertEquals(2, clientDns.size());
    assertEquals(testCn, clientDns.get(0));
    assertEquals(testCn2, clientDns.get(1));
    List<String> clientPasswords = standaloneConfig.getClientPasswords();
    assertEquals(2, clientPasswords.size());
    assertEquals(testPass1, clientPasswords.get(0));
    assertEquals(testPass2, clientPasswords.get(1));
}
Also used : StandaloneConfig(org.apache.nifi.toolkit.tls.configuration.StandaloneConfig) Test(org.junit.Test)

Example 3 with StandaloneConfig

use of org.apache.nifi.toolkit.tls.configuration.StandaloneConfig in project nifi by apache.

the class TlsToolkitStandaloneCommandLineTest method testNifiDnSuffix.

@Test
public void testNifiDnSuffix() throws CommandLineParseException {
    String testSuffix = ", O=apache, OU=nifi";
    tlsToolkitStandaloneCommandLine.parse("-n", "nifi", "--nifiDnSuffix", testSuffix);
    StandaloneConfig config = tlsToolkitStandaloneCommandLine.createConfig();
    assertEquals(testSuffix, config.getDnSuffix());
}
Also used : StandaloneConfig(org.apache.nifi.toolkit.tls.configuration.StandaloneConfig) Test(org.junit.Test)

Example 4 with StandaloneConfig

use of org.apache.nifi.toolkit.tls.configuration.StandaloneConfig in project nifi by apache.

the class TlsToolkitStandaloneCommandLineTest method testNifiDnPrefix.

@Test
public void testNifiDnPrefix() throws CommandLineParseException {
    String testPrefix = "O=apache, CN=";
    tlsToolkitStandaloneCommandLine.parse("-n", "nifi", "--nifiDnPrefix", testPrefix);
    StandaloneConfig config = tlsToolkitStandaloneCommandLine.createConfig();
    assertEquals(testPrefix, config.getDnPrefix());
}
Also used : StandaloneConfig(org.apache.nifi.toolkit.tls.configuration.StandaloneConfig) Test(org.junit.Test)

Example 5 with StandaloneConfig

use of org.apache.nifi.toolkit.tls.configuration.StandaloneConfig in project nifi by apache.

the class TlsToolkitStandaloneCommandLineTest method testClientDnMulti.

@Test
public void testClientDnMulti() throws CommandLineParseException {
    String testCn = "OU=NIFI,CN=testuser";
    String testCn2 = "OU=NIFI,CN=testuser2";
    tlsToolkitStandaloneCommandLine.parse("-C", testCn, "-C", testCn2);
    StandaloneConfig standaloneConfig = tlsToolkitStandaloneCommandLine.createConfig();
    List<String> clientDns = standaloneConfig.getClientDns();
    assertEquals(2, clientDns.size());
    assertEquals(testCn, clientDns.get(0));
    assertEquals(testCn2, clientDns.get(1));
    assertEquals(2, standaloneConfig.getClientPasswords().size());
}
Also used : StandaloneConfig(org.apache.nifi.toolkit.tls.configuration.StandaloneConfig) Test(org.junit.Test)

Aggregations

StandaloneConfig (org.apache.nifi.toolkit.tls.configuration.StandaloneConfig)5 Test (org.junit.Test)4