use of org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration 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));
}
use of org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration 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()));
}
use of org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration 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));
}
use of org.mule.runtime.api.tls.TlsContextKeyStoreConfiguration in project mule by mulesoft.
the class TlsNamespaceHandlerTestCase method testTlsContextKeyStoreProperties.
@Test
public void testTlsContextKeyStoreProperties() throws Exception {
TlsContextKeyStoreConfiguration keyStoreConfig = tlsContextFactory.getKeyStoreConfiguration();
assertThat(keyStoreConfig.getPath(), endsWith("serverKeystore"));
assertThat(keyStoreConfig.getPassword(), equalTo(PASSWORD));
assertThat(keyStoreConfig.getType(), equalTo(TYPE));
assertThat(keyStoreConfig.getKeyPassword(), equalTo(PASSWORD));
assertThat(keyStoreConfig.getAlgorithm(), equalTo(ALGORITHM));
assertThat(keyStoreConfig.getAlias(), equalTo(ALIAS));
}
Aggregations