use of org.apache.directory.ldap.client.api.LdapConnectionConfig in project graylog2-server by Graylog2.
the class LdapConnectorTest method setUp.
@Before
public void setUp() throws Exception {
final LdapServer server = getLdapServer();
final LdapConnectionConfig config = new LdapConnectionConfig();
config.setLdapHost("localHost");
config.setLdapPort(server.getPort());
config.setName(ADMIN_DN);
config.setCredentials(ADMIN_PASSWORD);
connector = new LdapConnector(10000);
connection = connector.connect(config);
}
use of org.apache.directory.ldap.client.api.LdapConnectionConfig in project graylog2-server by Graylog2.
the class LdapUserAuthenticatorTest method setUp.
@Before
public void setUp() throws Exception {
server = getLdapServer();
final LdapConnectionConfig ldapConfig = new LdapConnectionConfig();
ldapConfig.setLdapHost("localHost");
ldapConfig.setLdapPort(server.getPort());
ldapConfig.setName(ADMIN_DN);
ldapConfig.setCredentials(ADMIN_PASSWORD);
configuration = mock(Configuration.class);
when(configuration.getPasswordSecret()).thenReturn(PASSWORD_SECRET);
ldapConnector = new LdapConnector(10000);
ldapSettingsService = mock(LdapSettingsService.class);
userService = mock(UserService.class);
ldapSettings = new LdapSettingsImpl(configuration, mock(RoleService.class));
ldapSettings.setEnabled(true);
ldapSettings.setUri(URI.create("ldap://localhost:" + server.getPort()));
ldapSettings.setUseStartTls(false);
ldapSettings.setSystemUsername(ADMIN_DN);
ldapSettings.setSystemPassword(ADMIN_PASSWORD);
ldapSettings.setSearchBase("ou=users,dc=example,dc=com");
ldapSettings.setSearchPattern("(&(objectClass=posixAccount)(uid={0}))");
ldapSettings.setDisplayNameAttribute("cn");
ldapSettings.setActiveDirectory(false);
ldapSettings.setGroupSearchBase("ou=groups,dc=example,dc=com");
ldapSettings.setGroupIdAttribute("cn");
ldapSettings.setGroupSearchPattern("(|(objectClass=groupOfNames)(objectClass=posixGroup))");
}
Aggregations