Search in sources :

Example 6 with SslPolicyLoader

use of org.neo4j.ssl.config.SslPolicyLoader in project neo4j by neo4j.

the class SslPolicyLoaderTest method shouldThrowIfPolicyNameDoesNotExist.

@Test
void shouldThrowIfPolicyNameDoesNotExist() {
    // given
    SslPolicyConfig policyConfig = SslPolicyConfig.forScope(TESTING);
    Config config = newBuilder().set(neo4j_home, home.toAbsolutePath()).set(policyConfig.base_directory, Path.of("certificates/default")).build();
    SslPolicyLoader sslPolicyLoader = SslPolicyLoader.create(config, NullLogProvider.getInstance());
    // when
    assertThrows(IllegalArgumentException.class, () -> sslPolicyLoader.getPolicy(BOLT));
}
Also used : SslPolicyConfig(org.neo4j.configuration.ssl.SslPolicyConfig) SslPolicyConfig(org.neo4j.configuration.ssl.SslPolicyConfig) Config(org.neo4j.configuration.Config) SslPolicyLoader(org.neo4j.ssl.config.SslPolicyLoader) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with SslPolicyLoader

use of org.neo4j.ssl.config.SslPolicyLoader in project neo4j by neo4j.

the class SslPolicyLoaderTest method shouldReturnNullPolicyIfNullRequested.

@Test
void shouldReturnNullPolicyIfNullRequested() {
    // given
    SslPolicyLoader sslPolicyLoader = SslPolicyLoader.create(Config.defaults(), NullLogProvider.getInstance());
    // when
    SslPolicy sslPolicy = sslPolicyLoader.getPolicy(null);
    // then
    assertNull(sslPolicy);
}
Also used : SslPolicyLoader(org.neo4j.ssl.config.SslPolicyLoader) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with SslPolicyLoader

use of org.neo4j.ssl.config.SslPolicyLoader in project neo4j by neo4j.

the class SslPolicyLoaderTest method shouldLoadBaseCryptographicObjects.

@ParameterizedTest
@ValueSource(booleans = { true, false })
void shouldLoadBaseCryptographicObjects(boolean ignoreDotfiles) throws Exception {
    // when
    SslPolicyLoader sslPolicyLoader = createSslPolicyLoader(ignoreDotfiles);
    // then
    SslPolicy sslPolicy = sslPolicyLoader.getPolicy(TESTING);
    assertPolicyValid(sslPolicy);
}
Also used : SslPolicyLoader(org.neo4j.ssl.config.SslPolicyLoader) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

SslPolicyLoader (org.neo4j.ssl.config.SslPolicyLoader)8 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 DomainSocketAddress (io.netty.channel.unix.DomainSocketAddress)2 SslContext (io.netty.handler.ssl.SslContext)2 InetSocketAddress (java.net.InetSocketAddress)2 SocketAddress (java.net.SocketAddress)2 Duration (java.time.Duration)2 SSLException (javax.net.ssl.SSLException)2 Test (org.junit.jupiter.api.Test)2 SocketTransport (org.neo4j.bolt.transport.SocketTransport)2 IOException (java.io.IOException)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 CRLException (java.security.cert.CRLException)1 CertificateException (java.security.cert.CertificateException)1 Config (org.neo4j.configuration.Config)1 BoltConnector (org.neo4j.configuration.connectors.BoltConnector)1 SslPolicyConfig (org.neo4j.configuration.ssl.SslPolicyConfig)1