Search in sources :

Example 1 with TlsContextTrustStoreConfiguration

use of org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration in project mule by mulesoft.

the class PetStoreTlsConfigTestCase method assertTls.

private void assertTls(TlsContextFactory tls) {
    assertThat(tls, is(notNullValue()));
    TlsContextTrustStoreConfiguration trustStoreConfig = tls.getTrustStoreConfiguration();
    assertThat(trustStoreConfig.getPath().endsWith("ssltest-cacerts.jks"), is(true));
    assertThat(trustStoreConfig.getPassword(), equalTo(PASSWORD));
    TlsContextKeyStoreConfiguration keyStoreConfiguration = tls.getKeyStoreConfiguration();
    assertThat(keyStoreConfiguration.getPath().endsWith("ssltest-keystore.jks"), is(true));
    assertThat(keyStoreConfiguration.getKeyPassword(), equalTo(PASSWORD));
    assertThat(keyStoreConfiguration.getPassword(), equalTo(PASSWORD));
}
Also used : TlsContextKeyStoreConfiguration(org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration) TlsContextTrustStoreConfiguration(org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration)

Example 2 with TlsContextTrustStoreConfiguration

use of org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration in project mule by mulesoft.

the class DefaultTlsContextFactoryBuilderTestCase method buildsContext.

@Test
public void buildsContext() throws Exception {
    TlsContextFactory contextFactory = builder.enabledCipherSuites("TLS_SOMETHING").enabledProtocols("TLSv1.1").keyStorePath("serverKeystore").keyStorePassword("mulepassword").keyAlias("muleserver").keyPassword("mulepassword").keyStoreAlgorithm("PKIX").trustStorePath("trustStore").trustStorePassword("mulepassword").trustStoreType("jceks").insecureTrustStore(true).build();
    assertThat(contextFactory.getEnabledProtocols(), is(arrayContaining("TLSv1.1")));
    assertThat(contextFactory.getEnabledCipherSuites(), is(arrayContaining("TLS_SOMETHING")));
    TlsContextKeyStoreConfiguration keyStoreConfiguration = contextFactory.getKeyStoreConfiguration();
    assertThat(keyStoreConfiguration.getPath(), endsWith("serverKeystore"));
    assertThat(keyStoreConfiguration.getPassword(), is("mulepassword"));
    assertThat(keyStoreConfiguration.getKeyPassword(), is("mulepassword"));
    assertThat(keyStoreConfiguration.getAlias(), is("muleserver"));
    assertThat(keyStoreConfiguration.getType(), is(KeyStore.getDefaultType()));
    assertThat(keyStoreConfiguration.getAlgorithm(), is("PKIX"));
    TlsContextTrustStoreConfiguration trustStoreConfiguration = contextFactory.getTrustStoreConfiguration();
    assertThat(trustStoreConfiguration.getPath(), endsWith("trustStore"));
    assertThat(trustStoreConfiguration.getPassword(), is("mulepassword"));
    assertThat(trustStoreConfiguration.getType(), is("jceks"));
    assertThat(trustStoreConfiguration.getAlgorithm(), is(KeyManagerFactory.getDefaultAlgorithm()));
}
Also used : TlsContextKeyStoreConfiguration(org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration) TlsContextFactory(org.mule.runtime.api.tls.TlsContextFactory) TlsContextTrustStoreConfiguration(org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration) Test(org.junit.Test)

Example 3 with TlsContextTrustStoreConfiguration

use of org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration in project mule by mulesoft.

the class TlsNamespaceHandlerTestCase method testTlsContextProperties.

@Test
public void testTlsContextProperties() throws Exception {
    assertThat(tlsContextFactory.getEnabledProtocols(), is(new String[] { "TLSv1" }));
    assertThat(tlsContextFactory.getEnabledCipherSuites(), is(new String[] { "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" }));
    TlsContextTrustStoreConfiguration trustStoreConfiguration = tlsContextFactory.getTrustStoreConfiguration();
    assertThat(trustStoreConfiguration.getPath(), endsWith("trustStore"));
    assertThat(trustStoreConfiguration.getPassword(), equalTo(PASSWORD));
    assertThat(trustStoreConfiguration.getAlgorithm(), equalTo(ALGORITHM));
    assertThat(trustStoreConfiguration.getType(), equalTo(TYPE));
    TlsContextKeyStoreConfiguration keyStoreConfiguration = tlsContextFactory.getKeyStoreConfiguration();
    assertThat(keyStoreConfiguration.getPath(), endsWith("serverKeystore"));
    assertThat(keyStoreConfiguration.getPassword(), equalTo(PASSWORD));
    assertThat(keyStoreConfiguration.getType(), equalTo(TYPE));
    assertThat(keyStoreConfiguration.getKeyPassword(), equalTo(PASSWORD));
    assertThat(keyStoreConfiguration.getAlias(), equalTo(ALIAS));
    assertThat(keyStoreConfiguration.getAlgorithm(), equalTo(ALGORITHM));
}
Also used : TlsContextKeyStoreConfiguration(org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration) TlsContextTrustStoreConfiguration(org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration) Test(org.junit.Test)

Example 4 with TlsContextTrustStoreConfiguration

use of org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration in project mule by mulesoft.

the class TlsNamespaceHandlerTestCase method testTlsContextTrustStoreProperties.

@Test
public void testTlsContextTrustStoreProperties() throws Exception {
    TlsContextTrustStoreConfiguration trustStoreConfig = tlsContextFactory.getTrustStoreConfiguration();
    assertThat(trustStoreConfig.getPath(), endsWith("trustStore"));
    assertThat(trustStoreConfig.getPassword(), equalTo(PASSWORD));
    assertThat(trustStoreConfig.getType(), equalTo(TYPE));
    assertThat(trustStoreConfig.getAlgorithm(), equalTo(ALGORITHM));
    assertThat(trustStoreConfig.isInsecure(), equalTo(false));
}
Also used : TlsContextTrustStoreConfiguration(org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration) Test(org.junit.Test)

Aggregations

TlsContextTrustStoreConfiguration (org.mule.runtime.api.tls.TlsContextTrustStoreConfiguration)4 Test (org.junit.Test)3 TlsContextKeyStoreConfiguration (org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration)3 TlsContextFactory (org.mule.runtime.api.tls.TlsContextFactory)1