use of com.unboundid.ldap.listener.InMemoryDirectoryServer in project spring-boot by spring-projects.
the class EmbeddedLdapAutoConfigurationTests method testRandomPortWithEnvironment.
@Test
public void testRandomPortWithEnvironment() throws LDAPException {
load("spring.ldap.embedded.base-dn:dc=spring,dc=org");
InMemoryDirectoryServer server = this.context.getBean(InMemoryDirectoryServer.class);
assertThat(server.getListenPort()).isEqualTo(this.context.getEnvironment().getProperty("local.ldap.port", Integer.class));
}
use of com.unboundid.ldap.listener.InMemoryDirectoryServer in project spring-boot by spring-projects.
the class EmbeddedLdapAutoConfiguration method directoryServer.
@Bean
public InMemoryDirectoryServer directoryServer() throws LDAPException {
InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(this.embeddedProperties.getBaseDn());
if (hasCredentials(this.embeddedProperties.getCredential())) {
config.addAdditionalBindCredentials(this.embeddedProperties.getCredential().getUsername(), this.embeddedProperties.getCredential().getPassword());
}
setSchema(config);
InMemoryListenerConfig listenerConfig = InMemoryListenerConfig.createLDAPConfig("LDAP", this.embeddedProperties.getPort());
config.setListenerConfigs(listenerConfig);
this.server = new InMemoryDirectoryServer(config);
importLdif();
this.server.startListening();
setPortProperty(this.applicationContext, this.server.getListenPort());
return this.server;
}
use of com.unboundid.ldap.listener.InMemoryDirectoryServer in project cdap by caskdata.
the class ExternalLDAPAuthenticationServerTestBase method startExternalAuthenticationServer.
protected void startExternalAuthenticationServer() throws Exception {
InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig("dc=example,dc=com");
config.setListenerConfigs(ldapListenerConfig);
Entry defaultEntry = new Entry("dn: dc=example,dc=com", "objectClass: top", "objectClass: domain", "dc: example");
Entry userEntry = new Entry("dn: uid=user,dc=example,dc=com", "objectClass: inetorgperson", "cn: admin", "sn: User", "uid: user", "userPassword: realtime");
ldapServer = new InMemoryDirectoryServer(config);
ldapServer.addEntries(defaultEntry, userEntry);
ldapServer.startListening();
}
Aggregations