use of org.apache.directory.server.ldap.LdapServer in project aws-iam-ldap-bridge by denismo.
the class Runner method startServer.
/**
* starts the LdapServer
*
* @throws Exception
*/
public void startServer() throws Exception {
server = new LdapServer();
server.setTransports(new TcpTransport(serverPort));
server.setDirectoryService(service);
server.start();
}
use of org.apache.directory.server.ldap.LdapServer in project jackrabbit-oak by apache.
the class AbstractServer method setUp.
/**
* Get's the initial context factory for the provider's ou=system context
* root.
*/
protected void setUp() throws Exception {
File cwd = new File("target", "apacheds");
doDelete(cwd);
// setup directory service
directoryService = new DefaultDirectoryService();
directoryService.setShutdownHookEnabled(false);
directoryService.setInstanceLayout(new InstanceLayout(cwd));
cacheService = new CacheService();
cacheService.initialize(directoryService.getInstanceLayout());
SchemaManager schemaManager = new DefaultSchemaManager();
directoryService.setSchemaManager(schemaManager);
directoryService.setDnFactory(new DefaultDnFactory(directoryService.getSchemaManager(), cacheService.getCache("dnCache")));
AvlPartition schLdifPart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
schLdifPart.setId("schema");
schLdifPart.setSuffixDn(directoryService.getDnFactory().create(ServerDNConstants.CN_SCHEMA_DN));
SchemaPartition schPart = new SchemaPartition(directoryService.getSchemaManager());
schPart.setWrappedPartition(schLdifPart);
directoryService.setSchemaPartition(schPart);
AvlPartition sysPart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
sysPart.setId(SystemSchemaConstants.SCHEMA_NAME);
sysPart.setSuffixDn(directoryService.getDnFactory().create(ServerDNConstants.SYSTEM_DN));
directoryService.setSystemPartition(sysPart);
AvlPartition examplePart = new AvlPartition(directoryService.getSchemaManager(), directoryService.getDnFactory());
examplePart.setId("example");
examplePart.setSuffixDn(directoryService.getDnFactory().create(EXAMPLE_DN));
examplePart.setCacheService(cacheService);
directoryService.addPartition(examplePart);
// setup ldap server
port = AvailablePortFinder.getNextAvailable(1024);
ldapServer = new LdapServer();
setupLdapServer();
setupSaslMechanisms();
directoryService.startup();
setupExamplePartition();
startLdapServer();
setContexts(ServerDNConstants.ADMIN_SYSTEM_DN, "secret");
}
use of org.apache.directory.server.ldap.LdapServer in project undertow by undertow-io.
the class KerberosKDCUtil method startLdapServer.
private static void startLdapServer() throws Exception {
createWorkingDir();
DirectoryServiceFactory dsf = new DefaultDirectoryServiceFactory();
dsf.init(DIRECTORY_NAME);
directoryService = dsf.getDirectoryService();
// Derives the Kerberos keys for new entries.
directoryService.addLast(new KeyDerivationInterceptor());
directoryService.getChangeLog().setEnabled(false);
SchemaManager schemaManager = directoryService.getSchemaManager();
createPartition(dsf, schemaManager, "users", "ou=users,dc=undertow,dc=io");
CoreSession adminSession = directoryService.getAdminSession();
Map<String, String> mappings = Collections.singletonMap("hostname", DefaultServer.getDefaultServerAddress().getHostString());
processLdif(schemaManager, adminSession, "partition.ldif", mappings);
processLdif(schemaManager, adminSession, "krbtgt.ldif", mappings);
processLdif(schemaManager, adminSession, "user.ldif", mappings);
processLdif(schemaManager, adminSession, "server.ldif", mappings);
ldapServer = new LdapServer();
ldapServer.setServiceName("DefaultLDAP");
Transport ldap = new TcpTransport("0.0.0.0", LDAP_PORT, 3, 5);
ldapServer.addTransports(ldap);
ldapServer.setDirectoryService(directoryService);
ldapServer.start();
}
use of org.apache.directory.server.ldap.LdapServer in project spring-security by spring-projects.
the class ApacheDSContainer method afterPropertiesSet.
public void afterPropertiesSet() throws Exception {
if (workingDir == null) {
String apacheWorkDir = System.getProperty("apacheDSWorkDir");
if (apacheWorkDir == null) {
apacheWorkDir = createTempDirectory("apacheds-spring-security-");
}
setWorkingDirectory(new File(apacheWorkDir));
}
if (this.ldapOverSslEnabled && this.keyStoreFile == null) {
throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set.");
}
server = new LdapServer();
server.setDirectoryService(service);
// AbstractLdapIntegrationTests assume IPv4, so we specify the same here
TcpTransport transport = new TcpTransport(port);
if (ldapOverSslEnabled) {
transport.setEnableSSL(true);
server.setKeystoreFile(this.keyStoreFile.getAbsolutePath());
server.setCertificatePassword(this.certificatePassord);
}
server.setTransports(transport);
start();
}
use of org.apache.directory.server.ldap.LdapServer 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);
}
Aggregations