use of org.apache.directory.server.protocol.shared.transport.TcpTransport in project sonarqube by SonarSource.
the class ApacheDS method startLdapServer.
private ApacheDS startLdapServer(int port) throws Exception {
ldapServer.setTransports(new TcpTransport(port));
ldapServer.setDirectoryService(directoryService);
// Setup SASL mechanisms
Map<String, MechanismHandler> mechanismHandlerMap = new HashMap<>();
mechanismHandlerMap.put(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.CRAM_MD5, new CramMd5MechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.DIGEST_MD5, new DigestMd5MechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, new GssapiMechanismHandler());
ldapServer.setSaslMechanismHandlers(mechanismHandlerMap);
ldapServer.setSaslHost("localhost");
ldapServer.setSaslRealms(Collections.singletonList(realm));
// TODO ldapServer.setSaslPrincipal();
// The base DN containing users that can be SASL authenticated.
ldapServer.setSearchBaseDn(baseDn);
ldapServer.start();
return this;
}
use of org.apache.directory.server.protocol.shared.transport.TcpTransport in project sonarqube by SonarSource.
the class ApacheDS method startLdapServer.
private ApacheDS startLdapServer(int port) throws Exception {
ldapServer.setTransports(new TcpTransport(port));
ldapServer.setDirectoryService(directoryService);
// Setup SASL mechanisms
Map<String, MechanismHandler> mechanismHandlerMap = new HashMap<>();
mechanismHandlerMap.put(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.CRAM_MD5, new CramMd5MechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.DIGEST_MD5, new DigestMd5MechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, new GssapiMechanismHandler());
ldapServer.setSaslMechanismHandlers(mechanismHandlerMap);
ldapServer.setSaslHost("localhost");
ldapServer.setSaslRealms(Collections.singletonList(realm));
// TODO ldapServer.setSaslPrincipal();
// The base DN containing users that can be SASL authenticated.
ldapServer.setSearchBaseDn(baseDn);
ldapServer.start();
return this;
}
use of org.apache.directory.server.protocol.shared.transport.TcpTransport in project ranger by apache.
the class TestLdapUserGroup method setup.
@Before
public void setup() throws Exception {
LdapServer ldapServer = new LdapServer();
ldapServer.setSaslHost("127.0.0.1");
ldapServer.setSearchBaseDn("DC=ranger,DC=qe,DC=hortonworks,DC=com");
String ldapPort = System.getProperty("ldap.port");
Assert.assertNotNull("Property 'ldap.port' null", ldapPort);
ldapServer.setTransports(new TcpTransport("127.0.0.1", Integer.parseInt(ldapPort)));
ldapServer.setDirectoryService(getService());
ldapServer.setMaxSizeLimit(LdapServer.NO_SIZE_LIMIT);
setLdapServer(ldapServer);
getService().startup();
getLdapServer().start();
config = UserGroupSyncConfig.getInstance();
ldapBuilder = new LdapUserGroupBuilder();
sink = new PolicyMgrUserGroupBuilderTest();
}
use of org.apache.directory.server.protocol.shared.transport.TcpTransport in project knox by apache.
the class SimpleLdapServerTest method setup.
@BeforeClass
public static void setup() throws Exception {
ldifFile = new File(ClassLoader.getSystemResource("users.ldif").toURI());
ldapTransport = new TcpTransport(0);
ldap = new SimpleLdapDirectoryServer("dc=hadoop,dc=apache,dc=org", ldifFile, ldapTransport);
ldap.start();
port = ldapTransport.getAcceptor().getLocalAddress().getPort();
}
use of org.apache.directory.server.protocol.shared.transport.TcpTransport in project knox by apache.
the class GatewayTestDriver method setupLdap.
public int setupLdap(int port, File ldifConfig) throws Exception {
ldapTransport = new TcpTransport(port);
ldap = new SimpleLdapDirectoryServer("dc=hadoop,dc=apache,dc=org", ldifConfig, ldapTransport);
ldap.start();
log.info("LDAP port = " + ldapTransport.getAcceptor().getLocalAddress().getPort());
return port;
}
Aggregations