change subdomain, create contextlistener
1 files added
1 files renamed
9 files modified
| | |
| | | version: 1 |
| | | |
| | | dn: dc=saastest,dc=example,dc=com |
| | | dn: dc=domain,dc=example,dc=com |
| | | objectclass: top |
| | | objectclass: domain |
| | | administrativeRole: accessControlSpecificArea |
| | | dc: saastest |
| | | dc: domain |
| | | |
| | | dn: cn=saastestAuthenticationRequirementsACISubentry,dc=saastest,dc=example,dc=com |
| | | dn: cn=domainAuthenticationRequirementsACISubentry,dc=domain,dc=example,dc=com |
| | | objectClass: accessControlSubentry |
| | | objectClass: subentry |
| | | objectClass: top |
| | | subtreeSpecification: { } |
| | | prescriptiveACI: { identificationTag "subtreeFullAccessACI", precedence 11, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { name { "uid=application,ou=bind,dc=saastest,dc=example,dc=com" } }, userPermissions { { protectedItems { entry, allUserAttributeTypesAndValues }, grantsAndDenials { grantCompare, grantBrowse, grantRename, grantRemove, grantAdd, grantRead, grantFilterMatch, grantReturnDN, grantModify } } } } } |
| | | prescriptiveACI: { identificationTag "subtreeFullAccessACI", precedence 11, authenticationLevel simple, itemOrUserFirst userFirst: { userClasses { name { "uid=application,ou=bind,dc=domain,dc=example,dc=com" } }, userPermissions { { protectedItems { entry, allUserAttributeTypesAndValues }, grantsAndDenials { grantCompare, grantBrowse, grantRename, grantRemove, grantAdd, grantRead, grantFilterMatch, grantReturnDN, grantModify } } } } } |
| | | prescriptiveACI: { identificationTag "allUsersACI", precedence 9, authenticationLevel none, itemOrUserFirst userFirst: { userClasses { allUsers }, userPermissions { { protectedItems { attributeType { userPassword } }, grantsAndDenials { denyRead, denyFilterMatch, denyCompare } }, { protectedItems { entry, allUserAttributeTypesAndValues }, grantsAndDenials { grantCompare, grantBrowse,grantDiscloseOnError, grantRead, grantFilterMatch, grantReturnDN } } } } } |
| | | cn: saastestAuthenticationRequirementsACISubentry |
| | | cn: domainAuthenticationRequirementsACISubentry |
| | | |
| | | dn: ou=groups,dc=saastest,dc=example,dc=com |
| | | dn: ou=groups,dc=domain,dc=example,dc=com |
| | | objectClass: top |
| | | objectClass: organizationalUnit |
| | | ou: groups |
| | | |
| | | dn: ou=users,dc=saastest,dc=example,dc=com |
| | | dn: ou=users,dc=domain,dc=example,dc=com |
| | | objectClass: top |
| | | objectClass: organizationalUnit |
| | | ou: users |
| | | |
| | | dn: ou=bind,dc=saastest,dc=example,dc=com |
| | | dn: ou=bind,dc=domain,dc=example,dc=com |
| | | objectClass: top |
| | | objectClass: organizationalUnit |
| | | ou: bind |
| | | |
| | | dn: uid=admin,ou=users,dc=saastest,dc=example,dc=com |
| | | dn: uid=admin,ou=users,dc=domain,dc=example,dc=com |
| | | objectClass: top |
| | | objectClass: inetOrgPerson |
| | | objectClass: person |
| | |
| | | uid: admin |
| | | userPassword: admin-secret |
| | | |
| | | dn: uid=application,ou=bind,dc=saastest,dc=example,dc=com |
| | | dn: uid=application,ou=bind,dc=domain,dc=example,dc=com |
| | | objectClass: top |
| | | objectClass: inetOrgPerson |
| | | objectClass: person |
| | |
| | | <groupId>org.apache.directory.server</groupId> |
| | | <artifactId>apacheds-service</artifactId> |
| | | <version>2.0.0.AM25</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
File was renamed from src/test/java/de/jalin/ldapadmin/ldap/DirectoryServiceRunner.java |
| | |
| | | package de.jalin.ldapadmin.ldap; |
| | | |
| | | import java.io.File; |
| | | import java.io.FilenameFilter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | private final DirectoryService service; |
| | | |
| | | public DirectoryServiceRunner(final String dnString, final String ip, final String port) throws Exception { |
| | | service = initService(); |
| | | public DirectoryServiceRunner(final String partition, final String dnString, final String ip, final String port) throws Exception { |
| | | this.service = initService(partition); |
| | | addPartition("ou=config", "config"); |
| | | addPartition(dnString, "example"); |
| | | service.startup(); |
| | | addPartition(dnString, partition); |
| | | this.service.startup(); |
| | | loadData(); |
| | | startServer(ip, port); |
| | | } |
| | | |
| | | private DirectoryService initService() throws Exception { |
| | | private DirectoryService initService(final String partition) throws Exception { |
| | | final DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory(); |
| | | factory.init("example"); |
| | | factory.init(partition); |
| | | final DirectoryService directoryService = factory.getDirectoryService(); |
| | | directoryService.setShutdownHookEnabled(true); |
| | | directoryService.getChangeLog().setEnabled(false); |
| | |
| | | if (serviceRunner == null) { |
| | | final String dnName = "dc=" + name + ",dc=example,dc=com"; |
| | | try { |
| | | serviceRunner = new DirectoryServiceRunner(dnName, "127.0.0.1", "10389"); |
| | | serviceRunner = new DirectoryServiceRunner("example", dnName, "127.0.0.1", "10389"); |
| | | } catch (Exception e) { |
| | | throw new DirectoryServiceException(e); |
| | | } |
| | |
| | | final String ip = args[1]; |
| | | final String port = args[2]; |
| | | try { |
| | | final DirectoryServiceRunner ads = new DirectoryServiceRunner(dnString, ip, port); |
| | | final DirectoryServiceRunner ads = new DirectoryServiceRunner("example", dnString, ip, port); |
| | | final Entry result = ads.service.getAdminSession().lookup(new Dn(dnString)); |
| | | System.out.println("Found entry : " + result); |
| | | } catch (Exception e) { |
New file |
| | |
| | | package de.jalin.ldapadmin.server; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | import javax.servlet.ServletContextEvent; |
| | | import javax.servlet.ServletContextListener; |
| | | |
| | | public class WebappDirectoryServer implements ServletContextListener { |
| | | |
| | | @Override |
| | | public void contextInitialized(final ServletContextEvent evt) { |
| | | final ServletContext ctx = evt.getServletContext(); |
| | | final String uri = ctx.getInitParameter("uri"); |
| | | } |
| | | |
| | | @Override |
| | | public void contextDestroyed(final ServletContextEvent evt) { |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | public class TestCreateGroup { |
| | | |
| | | private static final String USERS_DN = "uid=${uid},ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=${uid},ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | private LDAPSession session; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | session = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | session = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | } |
| | | |
| | | @After |
| | |
| | | |
| | | public class TestCreateUser { |
| | | |
| | | private static final String USERS_DN = "uid=pet,ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=pet,ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | private LDAPSession session; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | session = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | session = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | } |
| | | |
| | | @After |
| | |
| | | |
| | | public class TestDeleteUser { |
| | | |
| | | private static final String USERS_DN = "uid=hei,ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=hei,ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | private LDAPSession session; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | session = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | session = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | } |
| | | |
| | | @After |
| | |
| | | |
| | | public class TestReadUser { |
| | | |
| | | private static final String USERS_DN = "uid=chr,ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=chr,ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | private LDAPSession session; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | session = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | session = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | } |
| | | |
| | | @After |
| | |
| | | |
| | | public class TestUpdateAsBindUser { |
| | | |
| | | private static final String USERS_DN = "uid=pau,ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=pau,ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | private LDAPSession session; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | session = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=application,ou=bind,dc=saastest,dc=example,dc=com", "app-secret"); |
| | | session = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=application,ou=bind,dc=domain,dc=example,dc=com", "app-secret"); |
| | | } |
| | | |
| | | @After |
| | |
| | | |
| | | public class TestUpdateAsSimpleUser { |
| | | |
| | | private static final String USERS_DN = "uid=mic,ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=mic,ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | final LDAPSession bindUserSession = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=application,ou=bind,dc=saastest,dc=example,dc=com", "app-secret"); |
| | | final LDAPSession bindUserSession = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=application,ou=bind,dc=domain,dc=example,dc=com", "app-secret"); |
| | | final UsersDAO dao = new UsersDAO(bindUserSession); |
| | | final User newUser = new User(); |
| | | newUser.setDn(USERS_DN); |
| | |
| | | @Test |
| | | public void test() { |
| | | try { |
| | | final LDAPSession simpleUserSession = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=plp,ou=users,dc=saastest,dc=example,dc=com", "geheim"); |
| | | final LDAPSession simpleUserSession = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=plp,ou=users,dc=domain,dc=example,dc=com", "geheim"); |
| | | final UsersDAO dao = new UsersDAO(simpleUserSession); |
| | | final User existingUser = dao.loadUsers().get(USERS_DN); |
| | | assertNull("user already exists", existingUser); |
| | |
| | | |
| | | public class TestUpdateUser { |
| | | |
| | | private static final String USERS_DN = "uid=kla,ou=users,dc=saastest,dc=example,dc=com"; |
| | | private static final String USERS_DN = "uid=kla,ou=users,dc=domain,dc=example,dc=com"; |
| | | |
| | | private LDAPSession session; |
| | | |
| | | @BeforeClass |
| | | public static void setupClass() throws Exception { |
| | | DirectoryServiceRunner.assureServiceRunning("saastest"); |
| | | DirectoryServiceRunner.assureServiceRunning("domain"); |
| | | } |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | session = new LDAPSession("ldap://localhost:10389/dc=saastest,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | session = new LDAPSession("ldap://localhost:10389/dc=domain,dc=example,dc=com", "uid=admin,ou=system", "streng-geheim"); |
| | | } |
| | | |
| | | @After |