change subdomain, create contextlistener
This commit is contained in:
parent
d783779ccf
commit
2c168b0663
@ -1,36 +1,36 @@
|
|||||||
version: 1
|
version: 1
|
||||||
|
|
||||||
dn: dc=saastest,dc=example,dc=com
|
dn: dc=domain,dc=example,dc=com
|
||||||
objectclass: top
|
objectclass: top
|
||||||
objectclass: domain
|
objectclass: domain
|
||||||
administrativeRole: accessControlSpecificArea
|
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: accessControlSubentry
|
||||||
objectClass: subentry
|
objectClass: subentry
|
||||||
objectClass: top
|
objectClass: top
|
||||||
subtreeSpecification: { }
|
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 } } } } }
|
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: top
|
||||||
objectClass: organizationalUnit
|
objectClass: organizationalUnit
|
||||||
ou: groups
|
ou: groups
|
||||||
|
|
||||||
dn: ou=users,dc=saastest,dc=example,dc=com
|
dn: ou=users,dc=domain,dc=example,dc=com
|
||||||
objectClass: top
|
objectClass: top
|
||||||
objectClass: organizationalUnit
|
objectClass: organizationalUnit
|
||||||
ou: users
|
ou: users
|
||||||
|
|
||||||
dn: ou=bind,dc=saastest,dc=example,dc=com
|
dn: ou=bind,dc=domain,dc=example,dc=com
|
||||||
objectClass: top
|
objectClass: top
|
||||||
objectClass: organizationalUnit
|
objectClass: organizationalUnit
|
||||||
ou: bind
|
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: top
|
||||||
objectClass: inetOrgPerson
|
objectClass: inetOrgPerson
|
||||||
objectClass: person
|
objectClass: person
|
||||||
@ -41,7 +41,7 @@ displayName: Directory Superuser
|
|||||||
uid: admin
|
uid: admin
|
||||||
userPassword: admin-secret
|
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: top
|
||||||
objectClass: inetOrgPerson
|
objectClass: inetOrgPerson
|
||||||
objectClass: person
|
objectClass: person
|
||||||
|
1
pom.xml
1
pom.xml
@ -66,7 +66,6 @@
|
|||||||
<groupId>org.apache.directory.server</groupId>
|
<groupId>org.apache.directory.server</groupId>
|
||||||
<artifactId>apacheds-service</artifactId>
|
<artifactId>apacheds-service</artifactId>
|
||||||
<version>2.0.0.AM25</version>
|
<version>2.0.0.AM25</version>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package de.jalin.ldapadmin.ldap;
|
package de.jalin.ldapadmin.ldap;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -28,18 +27,18 @@ public class DirectoryServiceRunner {
|
|||||||
|
|
||||||
private final DirectoryService service;
|
private final DirectoryService service;
|
||||||
|
|
||||||
public DirectoryServiceRunner(final String dnString, final String ip, final String port) throws Exception {
|
public DirectoryServiceRunner(final String partition, final String dnString, final String ip, final String port) throws Exception {
|
||||||
service = initService();
|
this.service = initService(partition);
|
||||||
addPartition("ou=config", "config");
|
addPartition("ou=config", "config");
|
||||||
addPartition(dnString, "example");
|
addPartition(dnString, partition);
|
||||||
service.startup();
|
this.service.startup();
|
||||||
loadData();
|
loadData();
|
||||||
startServer(ip, port);
|
startServer(ip, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DirectoryService initService() throws Exception {
|
private DirectoryService initService(final String partition) throws Exception {
|
||||||
final DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
|
final DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
|
||||||
factory.init("example");
|
factory.init(partition);
|
||||||
final DirectoryService directoryService = factory.getDirectoryService();
|
final DirectoryService directoryService = factory.getDirectoryService();
|
||||||
directoryService.setShutdownHookEnabled(true);
|
directoryService.setShutdownHookEnabled(true);
|
||||||
directoryService.getChangeLog().setEnabled(false);
|
directoryService.getChangeLog().setEnabled(false);
|
||||||
@ -85,7 +84,7 @@ public class DirectoryServiceRunner {
|
|||||||
if (serviceRunner == null) {
|
if (serviceRunner == null) {
|
||||||
final String dnName = "dc=" + name + ",dc=example,dc=com";
|
final String dnName = "dc=" + name + ",dc=example,dc=com";
|
||||||
try {
|
try {
|
||||||
serviceRunner = new DirectoryServiceRunner(dnName, "127.0.0.1", "10389");
|
serviceRunner = new DirectoryServiceRunner("example", dnName, "127.0.0.1", "10389");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new DirectoryServiceException(e);
|
throw new DirectoryServiceException(e);
|
||||||
}
|
}
|
||||||
@ -97,7 +96,7 @@ public class DirectoryServiceRunner {
|
|||||||
final String ip = args[1];
|
final String ip = args[1];
|
||||||
final String port = args[2];
|
final String port = args[2];
|
||||||
try {
|
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));
|
final Entry result = ads.service.getAdminSession().lookup(new Dn(dnString));
|
||||||
System.out.println("Found entry : " + result);
|
System.out.println("Found entry : " + result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
@ -0,0 +1,20 @@
|
|||||||
|
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) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -14,18 +14,18 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestCreateGroup {
|
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;
|
private LDAPSession session;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
@ -11,18 +11,18 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestCreateUser {
|
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;
|
private LDAPSession session;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
@ -11,18 +11,18 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestDeleteUser {
|
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;
|
private LDAPSession session;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
@ -11,18 +11,18 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestReadUser {
|
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;
|
private LDAPSession session;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
@ -15,18 +15,18 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestUpdateAsBindUser {
|
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;
|
private LDAPSession session;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
@ -17,16 +17,16 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestUpdateAsSimpleUser {
|
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
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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 UsersDAO dao = new UsersDAO(bindUserSession);
|
||||||
final User newUser = new User();
|
final User newUser = new User();
|
||||||
newUser.setDn(USERS_DN);
|
newUser.setDn(USERS_DN);
|
||||||
@ -54,7 +54,7 @@ public class TestUpdateAsSimpleUser {
|
|||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
try {
|
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 UsersDAO dao = new UsersDAO(simpleUserSession);
|
||||||
final User existingUser = dao.loadUsers().get(USERS_DN);
|
final User existingUser = dao.loadUsers().get(USERS_DN);
|
||||||
assertNull("user already exists", existingUser);
|
assertNull("user already exists", existingUser);
|
||||||
|
@ -14,18 +14,18 @@ import de.jalin.ldapadmin.beans.User;
|
|||||||
|
|
||||||
public class TestUpdateUser {
|
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;
|
private LDAPSession session;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupClass() throws Exception {
|
public static void setupClass() throws Exception {
|
||||||
DirectoryServiceRunner.assureServiceRunning("saastest");
|
DirectoryServiceRunner.assureServiceRunning("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
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
|
@After
|
||||||
|
Loading…
Reference in New Issue
Block a user