Search in sources :

Example 11 with SslPolicyConfig

use of org.neo4j.configuration.ssl.SslPolicyConfig 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 12 with SslPolicyConfig

use of org.neo4j.configuration.ssl.SslPolicyConfig in project neo4j by neo4j.

the class SslPolicyLoaderTest method createSslPolicyLoader.

private SslPolicyLoader createSslPolicyLoader(boolean ignoreDotfiles) {
    SslPolicyConfig policyConfig = SslPolicyConfig.forScope(TESTING);
    Config config = newBuilder().set(neo4j_home, home.toAbsolutePath()).set(SslSystemInternalSettings.ignore_dotfiles, ignoreDotfiles).set(policyConfig.enabled, Boolean.TRUE).set(policyConfig.base_directory, Path.of("certificates/default")).build();
    return SslPolicyLoader.create(config, NullLogProvider.getInstance());
}
Also used : SslPolicyConfig(org.neo4j.configuration.ssl.SslPolicyConfig) SslPolicyConfig(org.neo4j.configuration.ssl.SslPolicyConfig) Config(org.neo4j.configuration.Config)

Aggregations

SslPolicyConfig (org.neo4j.configuration.ssl.SslPolicyConfig)12 Config (org.neo4j.configuration.Config)6 IOException (java.io.IOException)3 SocketAddress (org.neo4j.configuration.helpers.SocketAddress)3 NoSuchFileException (java.nio.file.NoSuchFileException)2 CRLException (java.security.cert.CRLException)2 CertificateException (java.security.cert.CertificateException)2 SSLException (javax.net.ssl.SSLException)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 Path (java.nio.file.Path)1 SSLServerSocketFactory (javax.net.ssl.SSLServerSocketFactory)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 GraphDatabaseDependencies (org.neo4j.graphdb.facade.GraphDatabaseDependencies)1 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)1 Log4jLogProvider (org.neo4j.logging.log4j.Log4jLogProvider)1 LogConfig (org.neo4j.logging.log4j.LogConfig)1 Neo4jLoggerContext (org.neo4j.logging.log4j.Neo4jLoggerContext)1 SslPolicyLoader (org.neo4j.ssl.config.SslPolicyLoader)1