Search in sources :

Example 1 with SslConfiguration

use of com.palantir.conjure.java.api.config.ssl.SslConfiguration in project atlasdb by palantir.

the class AtlasDbConfigDeserializationTest method assertTimeLockConfigDeserializedCorrectly.

private void assertTimeLockConfigDeserializedCorrectly(TimeLockClientConfig timeLockClientConfig) {
    assertThat(timeLockClientConfig.getClientOrThrow()).isEqualTo("brian");
    assertThat(timeLockClientConfig.serversList().servers()).containsExactlyInAnyOrder("timelock1:8080", "timelock2:8080", "timelock3:8080");
    assertThat(timeLockClientConfig.serversList().sslConfiguration()).isPresent();
    SslConfiguration sslConfiguration = timeLockClientConfig.serversList().sslConfiguration().get();
    assertSslConfigDeserializedCorrectly(sslConfiguration);
}
Also used : SslConfiguration(com.palantir.conjure.java.api.config.ssl.SslConfiguration)

Example 2 with SslConfiguration

use of com.palantir.conjure.java.api.config.ssl.SslConfiguration in project conjure-java-runtime by palantir.

the class TestBase method createTestConfig.

protected final ClientConfiguration createTestConfig(String... uri) {
    SslConfiguration sslConfig = SslConfiguration.of(Paths.get("src/test/resources/trustStore.jks"));
    ClientConfiguration config = ClientConfigurations.of(ImmutableList.copyOf(uri), SslSocketFactories.createSslSocketFactory(sslConfig), SslSocketFactories.createX509TrustManager(sslConfig));
    return ClientConfiguration.builder().from(config).userAgent(AGENT).build();
}
Also used : SslConfiguration(com.palantir.conjure.java.api.config.ssl.SslConfiguration) ClientConfiguration(com.palantir.conjure.java.client.config.ClientConfiguration)

Example 3 with SslConfiguration

use of com.palantir.conjure.java.api.config.ssl.SslConfiguration in project conjure-java-runtime by palantir.

the class DropwizardSslClientAuthTests method testConnectionWorksWithClientCertsWithIntermediateCa.

@Test
public void testConnectionWorksWithClientCertsWithIntermediateCa() {
    SslConfiguration sslConfig = SslConfiguration.builder().trustStorePath(TestConstants.CA_TRUST_STORE_PATH).keyStorePath(TestConstants.CHILD_KEY_CERT_CHAIN_PEM_PATH).keyStorePassword("").keyStoreType(SslConfiguration.StoreType.PEM).build();
    TestEchoService service = createTestService(sslConfig);
    assertThat(service.echo("foo")).isEqualTo("foo");
}
Also used : SslConfiguration(com.palantir.conjure.java.api.config.ssl.SslConfiguration) Test(org.junit.Test)

Example 4 with SslConfiguration

use of com.palantir.conjure.java.api.config.ssl.SslConfiguration in project conjure-java-runtime by palantir.

the class DropwizardSslClientAuthTests method testConnectionFailsWithoutClientCerts.

@Test
public void testConnectionFailsWithoutClientCerts() {
    SslConfiguration sslConfig = SslConfiguration.of(TestConstants.CA_TRUST_STORE_PATH);
    TestEchoService service = createTestService(sslConfig);
    assertThatThrownBy(() -> service.echo("foo")).isInstanceOf(RetryableException.class);
}
Also used : SslConfiguration(com.palantir.conjure.java.api.config.ssl.SslConfiguration) Test(org.junit.Test)

Example 5 with SslConfiguration

use of com.palantir.conjure.java.api.config.ssl.SslConfiguration in project conjure-java-runtime by palantir.

the class DropwizardSslClientAuthTests method testConnectionWorksWithClientCerts.

@Test
public void testConnectionWorksWithClientCerts() {
    SslConfiguration sslConfig = SslConfiguration.of(TestConstants.CA_TRUST_STORE_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PASSWORD);
    TestEchoService service = createTestService(sslConfig);
    assertThat(service.echo("foo")).isEqualTo("foo");
}
Also used : SslConfiguration(com.palantir.conjure.java.api.config.ssl.SslConfiguration) Test(org.junit.Test)

Aggregations

SslConfiguration (com.palantir.conjure.java.api.config.ssl.SslConfiguration)41 Test (org.junit.Test)38 File (java.io.File)7 ClientConfiguration (com.palantir.conjure.java.client.config.ClientConfiguration)2 Paths (java.nio.file.Paths)2 Provider (java.security.Provider)2 Optional (java.util.Optional)2 SSLHandshakeException (javax.net.ssl.SSLHandshakeException)2 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)1 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)1 AtlasDbConfig (com.palantir.atlasdb.config.AtlasDbConfig)1 AtlasDbRuntimeConfig (com.palantir.atlasdb.config.AtlasDbRuntimeConfig)1 ImmutableAtlasDbConfig (com.palantir.atlasdb.config.ImmutableAtlasDbConfig)1 ImmutableAtlasDbRuntimeConfig (com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig)1 ImmutableServerListConfig (com.palantir.atlasdb.config.ImmutableServerListConfig)1 ImmutableTimeLockClientConfig (com.palantir.atlasdb.config.ImmutableTimeLockClientConfig)1 RemotingClientConfigs (com.palantir.atlasdb.config.RemotingClientConfigs)1 LockDiagnosticComponents (com.palantir.atlasdb.debug.LockDiagnosticComponents)1