Search in sources :

Example 1 with EncryptedValueService

use of org.graylog2.security.encryption.EncryptedValueService in project graylog2-server by Graylog2.

the class UnboundLDAPConnectorTest method setUp.

@Before
public void setUp() throws Exception {
    final LdapServer server = getLdapServer();
    final LDAPConnectorConfig.LDAPServer unreachableServer = LDAPConnectorConfig.LDAPServer.create("localhost", 9);
    final LDAPConnectorConfig.LDAPServer ldapServer = LDAPConnectorConfig.LDAPServer.create("localhost", server.getPort());
    final LDAPConnectorConfig connectorConfig = LDAPConnectorConfig.builder().systemUsername(ADMIN_DN).systemPassword(encryptedValueService.encrypt(ADMIN_PASSWORD)).transportSecurity(LDAPTransportSecurity.NONE).verifyCertificates(false).serverList(ImmutableList.of(unreachableServer, ldapServer)).build();
    connector = new UnboundLDAPConnector(10000, new TLSProtocolsConfiguration(), mock(TrustManagerProvider.class), encryptedValueService);
    connection = connector.connect(connectorConfig);
}
Also used : CreateLdapServer(org.apache.directory.server.annotations.CreateLdapServer) LdapServer(org.apache.directory.server.ldap.LdapServer) TLSProtocolsConfiguration(org.graylog2.configuration.TLSProtocolsConfiguration) Before(org.junit.Before)

Example 2 with EncryptedValueService

use of org.graylog2.security.encryption.EncryptedValueService in project graylog2-server by Graylog2.

the class EncryptedValueTest method setUp.

@BeforeEach
void setUp(MongoDBTestService mongodb) {
    encryptedValueService = new EncryptedValueService("1234567890abcdef");
    this.objectMapper = new ObjectMapperProvider(ObjectMapperProvider.class.getClassLoader(), Collections.emptySet(), encryptedValueService, GRNRegistry.createWithBuiltinTypes()).get();
    this.dbService = new TestService(mongodb.mongoConnection(), new MongoJackObjectMapperProvider(objectMapper));
}
Also used : MongoDBTestService(org.graylog.testing.mongodb.MongoDBTestService) MongoJackObjectMapperProvider(org.graylog2.bindings.providers.MongoJackObjectMapperProvider) MongoJackObjectMapperProvider(org.graylog2.bindings.providers.MongoJackObjectMapperProvider) ObjectMapperProvider(org.graylog2.shared.bindings.providers.ObjectMapperProvider) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

CreateLdapServer (org.apache.directory.server.annotations.CreateLdapServer)1 LdapServer (org.apache.directory.server.ldap.LdapServer)1 MongoDBTestService (org.graylog.testing.mongodb.MongoDBTestService)1 MongoJackObjectMapperProvider (org.graylog2.bindings.providers.MongoJackObjectMapperProvider)1 TLSProtocolsConfiguration (org.graylog2.configuration.TLSProtocolsConfiguration)1 ObjectMapperProvider (org.graylog2.shared.bindings.providers.ObjectMapperProvider)1 Before (org.junit.Before)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1