Search in sources :

Example 1 with LdapSettingsImpl

use of org.graylog2.security.ldap.LdapSettingsImpl 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))");
}
Also used : LdapSettingsService(org.graylog2.security.ldap.LdapSettingsService) Configuration(org.graylog2.Configuration) UserService(org.graylog2.shared.users.UserService) LdapSettingsImpl(org.graylog2.security.ldap.LdapSettingsImpl) LdapConnectionConfig(org.apache.directory.ldap.client.api.LdapConnectionConfig) LdapConnector(org.graylog2.security.ldap.LdapConnector) Before(org.junit.Before)

Aggregations

LdapConnectionConfig (org.apache.directory.ldap.client.api.LdapConnectionConfig)1 Configuration (org.graylog2.Configuration)1 LdapConnector (org.graylog2.security.ldap.LdapConnector)1 LdapSettingsImpl (org.graylog2.security.ldap.LdapSettingsImpl)1 LdapSettingsService (org.graylog2.security.ldap.LdapSettingsService)1 UserService (org.graylog2.shared.users.UserService)1 Before (org.junit.Before)1