use of org.apache.directory.server.core.api.DirectoryService in project qpid-broker-j by apache.
the class SimpleLDAPAuthenticationManagerTest method createPrincipal.
private void createPrincipal(final String sn, final String cn, final String uid, final String userPassword, final String kerberosPrincipalName) throws LdapException {
final DirectoryService directoryService = LDAP.getDirectoryService();
final Entry entry = new DefaultEntry(directoryService.getSchemaManager());
entry.setDn(String.format("uid=%s,%s", uid, USERS_DN));
entry.add("objectClass", "top", "person", "inetOrgPerson", "krb5principal", "krb5kdcentry");
entry.add("cn", cn);
entry.add("sn", sn);
entry.add("uid", uid);
entry.add("userPassword", userPassword);
entry.add("krb5PrincipalName", kerberosPrincipalName);
entry.add("krb5KeyVersionNumber", "0");
directoryService.getAdminSession().add(entry);
}
use of org.apache.directory.server.core.api.DirectoryService in project syncope by apache.
the class ApacheDSRootDseServlet method createEnv.
/**
* Creates an environment configuration for JNDI access.
*/
private Properties createEnv() {
// Fetch directory service from servlet context
ServletContext servletContext = this.getServletContext();
DirectoryService directoryService = (DirectoryService) servletContext.getAttribute(DirectoryService.JNDI_KEY);
Properties env = new Properties();
env.put(DirectoryService.JNDI_KEY, directoryService);
env.put(Context.PROVIDER_URL, "");
env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());
env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
return env;
}
use of org.apache.directory.server.core.api.DirectoryService in project structr by structr.
the class LDAPServerService method initialized.
@Override
public void initialized() {
try {
// TEST
final DirectoryService service = server.getDirectoryService();
final SchemaManager schemaManager = service.getSchemaManager();
final Dn structrDn = new Dn(schemaManager, "dc=org");
final Partition apachePartition = new StructrPartition(schemaManager, "structr", structrDn);
apachePartition.initialize();
service.addPartition(apachePartition);
try {
service.getAdminSession().lookup(structrDn);
} catch (LdapException lnnfe) {
Entry structrEntry = service.newEntry(structrDn);
structrEntry.add("objectClass", "top", "domain", "extensibleObject");
structrEntry.add("dc", "structr");
service.getAdminSession().add(structrEntry);
}
try {
System.out.println("######: " + service.getAdminSession().lookup(structrDn));
System.out.flush();
} catch (LdapException lnnfe) {
logger.warn("", lnnfe);
}
} catch (Throwable t) {
logger.warn("", t);
}
}
use of org.apache.directory.server.core.api.DirectoryService in project cloudstack by apache.
the class LdapDirectoryServerConnectionTest method testEmbeddedLdapServerInitialization.
@Test
public void testEmbeddedLdapServerInitialization() throws IndexNotFoundException {
LdapServer ldapServer = embeddedLdapServer.getLdapServer();
assertNotNull(ldapServer);
DirectoryService directoryService = embeddedLdapServer.getDirectoryService();
assertNotNull(directoryService);
assertNotNull(directoryService.getSchemaPartition());
assertNotNull(directoryService.getSystemPartition());
assertNotNull(directoryService.getSchemaManager());
assertNotNull(directoryService.getDnFactory());
assertNotNull(directoryService.isDenormalizeOpAttrsEnabled());
ChangeLog changeLog = directoryService.getChangeLog();
assertNotNull(changeLog);
assertFalse(changeLog.isEnabled());
assertNotNull(directoryService.isStarted());
assertNotNull(ldapServer.isStarted());
List userList = new ArrayList(embeddedLdapServer.getUserIndexMap().keySet());
java.util.Collections.sort(userList);
List checkList = Arrays.asList("uid");
assertEquals(userList, checkList);
}
use of org.apache.directory.server.core.api.DirectoryService in project keycloak by keycloak.
the class KerberosEmbeddedServer method createDirectoryService.
@Override
protected DirectoryService createDirectoryService() throws Exception {
DirectoryService directoryService = super.createDirectoryService();
directoryService.addLast(new KeyDerivationInterceptor());
return directoryService;
}
Aggregations