LDAP-56: generic integration tests are now configurable to run against a local LDAP server rather than startin in-process ApacheDS.
This commit is contained in:
@@ -99,6 +99,6 @@ public class TransactionAwareContextSourceProxy
|
||||
}
|
||||
|
||||
public DirContext getContext(String principal, String credentials) throws NamingException {
|
||||
throw new UnsupportedOperationException("Not supported on a transacted ContextSource");
|
||||
return target.getContext(principal, credentials);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.ldap.test;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.directory.server.core.DefaultDirectoryService;
|
||||
import org.apache.directory.server.core.DirectoryService;
|
||||
import org.apache.directory.server.core.entry.ServerEntry;
|
||||
@@ -35,6 +36,7 @@ import java.io.File;
|
||||
public final class EmbeddedLdapServer {
|
||||
private final DirectoryService directoryService;
|
||||
private final LdapServer ldapServer;
|
||||
private static File workingDirectory;
|
||||
|
||||
private EmbeddedLdapServer(DirectoryService directoryService,
|
||||
LdapServer ldapServer) {
|
||||
@@ -44,11 +46,14 @@ public final class EmbeddedLdapServer {
|
||||
|
||||
public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName, String defaultPartitionSuffix, int port)
|
||||
throws Exception{
|
||||
workingDirectory = new File(System.getProperty("java.io.tmpdir") + "/apacheds-test1");
|
||||
FileUtils.deleteDirectory(workingDirectory);
|
||||
|
||||
DefaultDirectoryService directoryService = new DefaultDirectoryService();
|
||||
directoryService.setShutdownHookEnabled(true);
|
||||
directoryService.setAllowAnonymousAccess(true);
|
||||
directoryService.setWorkingDirectory(new File(System.getProperty("java.io.tmpdir") + "/apacheds-test1"));
|
||||
|
||||
directoryService.setWorkingDirectory(workingDirectory);
|
||||
directoryService.getChangeLog().setEnabled( false );
|
||||
|
||||
JdbmPartition partition = new JdbmPartition();
|
||||
@@ -80,5 +85,7 @@ public final class EmbeddedLdapServer {
|
||||
public void shutdown() throws Exception {
|
||||
ldapServer.stop();
|
||||
directoryService.shutdown();
|
||||
|
||||
FileUtils.deleteDirectory(workingDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +229,10 @@ public final class LdapTestUtils {
|
||||
}
|
||||
|
||||
private static void loadLdif(DirContext context, Resource ldifFile) throws IOException {
|
||||
loadLdif(context, LdapUtils.emptyLdapName(), ldifFile);
|
||||
}
|
||||
|
||||
private static void loadLdif(DirContext context, Name rootNode, Resource ldifFile) {
|
||||
try {
|
||||
LdapName baseDn = (LdapName)
|
||||
context.getEnvironment().get(DefaultDirObjectFactory.JNDI_ENV_BASE_PATH_KEY);
|
||||
@@ -243,9 +247,13 @@ public final class LdapTestUtils {
|
||||
if(baseDn != null) {
|
||||
dn = LdapUtils.removeFirst(dn, baseDn);
|
||||
}
|
||||
|
||||
if(!rootNode.isEmpty()) {
|
||||
dn = LdapUtils.prepend(dn, rootNode);
|
||||
}
|
||||
context.bind(dn, null, record);
|
||||
}
|
||||
} catch (NamingException e) {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to populate LDIF", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.ldap.itest;
|
||||
import org.junit.Before;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
@@ -38,6 +39,12 @@ public abstract class AbstractLdapTemplateIntegrationTest extends AbstractJUnit4
|
||||
@Qualifier("contextSource")
|
||||
protected ContextSource contextSource;
|
||||
|
||||
@Value("${base}")
|
||||
protected String base;
|
||||
|
||||
@Value("${testRoot}")
|
||||
protected String testRoot;
|
||||
|
||||
@Before
|
||||
public void cleanAndSetup() throws NamingException, IOException {
|
||||
LdapTestUtils.cleanAndSetup(contextSource, getRoot(), getLdifFileResource());
|
||||
|
||||
@@ -64,7 +64,7 @@ public class LdapTemplateBindUnbindITest extends
|
||||
ctx.addAttributeValue("cn", "TEST");
|
||||
ctx.addAttributeValue("objectclass", "top");
|
||||
ctx.addAttributeValue("objectclass", "groupOfUniqueNames");
|
||||
ctx.addAttributeValue("uniqueMember", LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se"));
|
||||
ctx.addAttributeValue("uniqueMember", LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base));
|
||||
tested.bind(ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@ import org.springframework.ldap.core.AttributesMapper;
|
||||
import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.core.support.AbstractContextSource;
|
||||
import org.springframework.ldap.itest.Person;
|
||||
import org.springframework.ldap.itest.PersonAttributesMapper;
|
||||
import org.springframework.ldap.itest.PersonContextMapper;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -72,7 +68,7 @@ public class LdapTemplateLookupITest extends AbstractLdapTemplateIntegrationTest
|
||||
DirContextAdapter result = (DirContextAdapter) tested.lookup("");
|
||||
|
||||
assertEquals("", result.getDn().toString());
|
||||
assertEquals("dc=jayway,dc=se", result.getNameInNamespace());
|
||||
assertEquals(base, result.getNameInNamespace());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -214,7 +210,7 @@ public class LdapTemplateLookupITest extends AbstractLdapTemplateIntegrationTest
|
||||
|
||||
LdapName expectedName = LdapUtils.newLdapName(expectedDn);
|
||||
assertEquals(expectedName, result.getDn());
|
||||
assertEquals("cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se", result.getNameInNamespace());
|
||||
assertEquals("cn=Some Person2,ou=company1,c=Sweden," + base, result.getNameInNamespace());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -222,29 +218,6 @@ public class LdapTemplateLookupITest extends AbstractLdapTemplateIntegrationTest
|
||||
DirContextAdapter result = (DirContextAdapter) tested.lookup("cn=Some Person+sn=Person,ou=company1,c=Norway");
|
||||
|
||||
assertEquals("cn=Some Person+sn=Person,ou=company1,c=Norway", result.getDn().toString());
|
||||
assertEquals("cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se", result.getNameInNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests bind and lookup with Java objects where the ContextSource already
|
||||
* has a DirObjectFactory configured.
|
||||
*/
|
||||
@Test
|
||||
public void testBindJavaObject() throws Exception {
|
||||
AbstractContextSource contextSource = (AbstractContextSource) tested.getContextSource();
|
||||
Class originalObjectFactory = contextSource.getDirObjectFactory();
|
||||
try {
|
||||
contextSource.setDirObjectFactory(null);
|
||||
contextSource.afterPropertiesSet();
|
||||
tested.bind("cn=myRandomInt", new Integer(54321), null);
|
||||
Integer result = (Integer) tested.lookup("cn=myRandomInt");
|
||||
assertEquals(54321, result.intValue());
|
||||
}
|
||||
finally {
|
||||
// reset the DirObjectFactory so as not to disturb other tests
|
||||
tested.unbind("cn=myRandomInt");
|
||||
contextSource.setDirObjectFactory(originalObjectFactory);
|
||||
contextSource.afterPropertiesSet();
|
||||
}
|
||||
assertEquals("cn=Some Person+sn=Person,ou=company1,c=Norway," + base, result.getNameInNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ldap.AttributeInUseException;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -161,43 +160,6 @@ public class LdapTemplateModifyITest extends AbstractLdapTemplateIntegrationTest
|
||||
}
|
||||
}
|
||||
|
||||
// LDAP-188
|
||||
@Test
|
||||
public void testModifyAttributes_AddAttributeValueAsDistinguishedName() {
|
||||
try {
|
||||
// prepare test data
|
||||
String dn = "cn=ROLE_USER,ou=groups";
|
||||
String lowerCasedName = "cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se";
|
||||
String upperCasedName = "CN=Some Person,OU=company1,C=Sweden,DC=jayway,DC=se";
|
||||
DirContextOperations ctx = tested.lookupContext(dn);
|
||||
ctx.removeAttributeValue("uniqueMember", lowerCasedName);
|
||||
tested.modifyAttributes(ctx);
|
||||
|
||||
ctx = tested.lookupContext(dn);
|
||||
ctx.addAttributeValue("uniqueMember", upperCasedName);
|
||||
tested.modifyAttributes(ctx);
|
||||
|
||||
// without this, the member added above will not be removed and the test fails
|
||||
System.setProperty(DistinguishedName.KEY_CASE_FOLD_PROPERTY, DistinguishedName.KEY_CASE_FOLD_NONE);
|
||||
|
||||
ctx = tested.lookupContext(dn);
|
||||
ctx.removeAttributeValue("uniqueMember", new DistinguishedName(upperCasedName).toCompactString());
|
||||
tested.modifyAttributes(ctx);
|
||||
|
||||
// verify
|
||||
DirContextAdapter result = (DirContextAdapter) tested.lookup(dn);
|
||||
String[] attributes = result.getStringAttributes("uniqueMember");
|
||||
assertEquals(4, attributes.length);
|
||||
assertEquals("0", "cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se", attributes[0]);
|
||||
assertEquals("1", "cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se", attributes[1]);
|
||||
assertEquals("2", "cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se", attributes[2]);
|
||||
assertEquals("3", "cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se", attributes[3]);
|
||||
}
|
||||
finally {
|
||||
System.clearProperty(DistinguishedName.KEY_CASE_FOLD_PROPERTY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test written originally to verify that duplicates are allowed on ordered
|
||||
* attributes, but had to be changed since Apache DS seems to disallow
|
||||
|
||||
@@ -48,7 +48,7 @@ public class LdapTemplateNoBaseSuffixITest extends AbstractLdapTemplateIntegrati
|
||||
|
||||
@Override
|
||||
protected Name getRoot() {
|
||||
return LdapUtils.newLdapName("dc=jayway,dc=se");
|
||||
return LdapUtils.newLdapName(base);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public class LdapTemplateNoBaseSuffixITest extends AbstractLdapTemplateIntegrati
|
||||
*/
|
||||
@Test
|
||||
public void testLookup_Plain() {
|
||||
String expectedDn = "cn=Some Person2, ou=company1, c=Sweden, dc=jayway, dc=se";
|
||||
String expectedDn = "cn=Some Person2, ou=company1, c=Sweden," + base;
|
||||
DirContextAdapter result = (DirContextAdapter) tested.lookup(expectedDn);
|
||||
|
||||
assertEquals("Some Person2", result.getStringAttribute("cn"));
|
||||
@@ -73,7 +73,7 @@ public class LdapTemplateNoBaseSuffixITest extends AbstractLdapTemplateIntegrati
|
||||
public void testSearch_Plain() {
|
||||
CountNameClassPairCallbackHandler handler = new CountNameClassPairCallbackHandler();
|
||||
|
||||
tested.search("dc=jayway, dc=se", "(objectclass=person)", handler);
|
||||
tested.search(base, "(objectclass=person)", handler);
|
||||
assertEquals(5, handler.getNoOfRows());
|
||||
}
|
||||
|
||||
@@ -83,18 +83,18 @@ public class LdapTemplateNoBaseSuffixITest extends AbstractLdapTemplateIntegrati
|
||||
adapter.setAttributeValues("objectclass", new String[] { "top", "person" });
|
||||
adapter.setAttributeValue("cn", "Some Person4");
|
||||
adapter.setAttributeValue("sn", "Person4");
|
||||
tested.bind("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se", adapter, null);
|
||||
tested.bind("cn=Some Person4, ou=company1, c=Sweden," + base, adapter, null);
|
||||
|
||||
DirContextAdapter result = (DirContextAdapter) tested
|
||||
.lookup("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se");
|
||||
.lookup("cn=Some Person4, ou=company1, c=Sweden," + base);
|
||||
|
||||
assertEquals("Some Person4", result.getStringAttribute("cn"));
|
||||
assertEquals("Person4", result.getStringAttribute("sn"));
|
||||
assertEquals(LdapUtils.newLdapName("cn=Some Person4,ou=company1,c=Sweden,dc=jayway,dc=se"), result.getDn());
|
||||
assertEquals(LdapUtils.newLdapName("cn=Some Person4,ou=company1,c=Sweden," + base), result.getDn());
|
||||
|
||||
tested.unbind("cn=Some Person4,ou=company1,c=Sweden,dc=jayway,dc=se");
|
||||
tested.unbind("cn=Some Person4,ou=company1,c=Sweden," + base);
|
||||
try {
|
||||
tested.lookup("cn=Some Person4, ou=company1, c=Sweden, dc=jayway, dc=se");
|
||||
tested.lookup("cn=Some Person4, ou=company1, c=Sweden," + base);
|
||||
fail("NameNotFoundException expected");
|
||||
}
|
||||
catch (NameNotFoundException expected) {
|
||||
|
||||
@@ -17,17 +17,15 @@
|
||||
package org.springframework.ldap.itest;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.pool.factory.PoolingContextSource;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
import org.springframework.ldap.test.LdapTestUtils;
|
||||
import org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
|
||||
@@ -36,10 +34,7 @@ import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.fail;
|
||||
|
||||
/**
|
||||
* Tests the lookup methods of LdapTemplate.
|
||||
*
|
||||
* @author Mattias Hellborg Arthursson
|
||||
* @author Ulrik Sandberg
|
||||
* This test only works against in-process Apache DS server, regardless of configured profile.
|
||||
*/
|
||||
@ContextConfiguration(locations = {"/conf/ldapTemplatePooledTestContext.xml"})
|
||||
public class LdapTemplatePooledITest extends AbstractJUnit4SpringContextTests {
|
||||
@@ -50,6 +45,9 @@ public class LdapTemplatePooledITest extends AbstractJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private ContextSource contextSource;
|
||||
|
||||
@Value("${base}")
|
||||
protected String base;
|
||||
|
||||
@After
|
||||
public void cleanup() throws Exception {
|
||||
LdapTestUtils.shutdownEmbeddedServer();
|
||||
@@ -62,7 +60,7 @@ public class LdapTemplatePooledITest extends AbstractJUnit4SpringContextTests {
|
||||
*/
|
||||
@Test
|
||||
public void verifyThatInvalidConnectionIsAutomaticallyPurged() throws Exception {
|
||||
LdapTestUtils.startEmbeddedServer(1888, "dc=jayway,dc=se", "jayway");
|
||||
LdapTestUtils.startEmbeddedServer(1888, base, "jayway");
|
||||
LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif"));
|
||||
|
||||
DirContextOperations result = tested.lookupContext("cn=Some Person2, ou=company1,c=Sweden");
|
||||
@@ -72,7 +70,7 @@ public class LdapTemplatePooledITest extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
// Shutdown server and kill all existing connections
|
||||
LdapTestUtils.shutdownEmbeddedServer();
|
||||
LdapTestUtils.startEmbeddedServer(1888, "dc=jayway,dc=se", "jayway");
|
||||
LdapTestUtils.startEmbeddedServer(1888, base, "jayway");
|
||||
|
||||
try {
|
||||
tested.lookup("cn=Some Person2, ou=company1,c=Sweden");
|
||||
@@ -82,6 +80,7 @@ public class LdapTemplatePooledITest extends AbstractJUnit4SpringContextTests {
|
||||
assertTrue(true);
|
||||
}
|
||||
|
||||
LdapTestUtils.cleanAndSetup(contextSource, LdapUtils.emptyLdapName(), new ClassPathResource("/setup_data.ldif"));
|
||||
// But this should be OK, because the dirty connection should have been automatically purged.
|
||||
tested.lookup("cn=Some Person2, ou=company1,c=Sweden");
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import javax.naming.Name;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Provides tests that verify that the server supports certain controls.
|
||||
@@ -45,7 +46,7 @@ public class SupportedControlsITest extends AbstractLdapTemplateIntegrationTest
|
||||
|
||||
@Override
|
||||
protected Name getRoot() {
|
||||
return LdapUtils.newLdapName("dc=jayway,dc=se");
|
||||
return LdapUtils.newLdapName(base);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -64,9 +65,11 @@ public class SupportedControlsITest extends AbstractLdapTemplateIntegrationTest
|
||||
|
||||
String[] controls = (String[]) tested.lookup("", new String[] { SUPPORTED_CONTROL }, mapper);
|
||||
System.out.println(Arrays.toString(controls));
|
||||
assertEquals("Persistent Search LDAPv3 control,", "2.16.840.1.113730.3.4.3", controls[0]);
|
||||
assertEquals("Entry Change Notification LDAPv3 control,", "2.16.840.1.113730.3.4.7", controls[1]);
|
||||
assertEquals("Subentries Control,", "1.3.6.1.4.1.4203.1.10.1", controls[2]);
|
||||
assertEquals("Manage DSA IT LDAPv3 control,", "2.16.840.1.113730.3.4.2", controls[3]);
|
||||
|
||||
HashSet<String> controlsSet = new HashSet<String>(Arrays.asList(controls));
|
||||
|
||||
assertTrue("Entry Change Notification LDAPv3 control,", controlsSet.contains("1.3.6.1.4.1.4203.1.10.1"));
|
||||
assertTrue("Subentries Control,", controlsSet.contains("1.3.6.1.4.1.4203.1.10.1"));
|
||||
assertTrue("Manage DSA IT LDAPv3 control,", controlsSet.contains("2.16.840.1.113730.3.4.2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ public class BaseLdapPathBeanPostprocessorITest {
|
||||
|
||||
DistinguishedName base = tested.getBase();
|
||||
assertNotNull(base);
|
||||
assertEquals(new DistinguishedName("dc=jayway,dc=se"), base);
|
||||
assertEquals(new DistinguishedName("dc=261consulting,dc=com"), base);
|
||||
|
||||
DummyBaseLdapNameAware otherTested = ctx.getBean(DummyBaseLdapNameAware.class);
|
||||
assertEquals(LdapUtils.newLdapName("dc=jayway,dc=se"), otherTested.getBaseLdapPath());
|
||||
assertEquals(LdapUtils.newLdapName("dc=261consulting,dc=com"), otherTested.getBaseLdapPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,7 +69,7 @@ public class BaseLdapPathBeanPostprocessorITest {
|
||||
|
||||
DistinguishedName base = tested.getBase();
|
||||
assertNotNull(base);
|
||||
assertEquals(new DistinguishedName("cn=john doe,dc=jayway,dc=se"), base);
|
||||
assertEquals(new DistinguishedName("cn=john doe,dc=261consulting,dc=com"), base);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -103,6 +103,6 @@ public class BaseLdapPathBeanPostprocessorITest {
|
||||
|
||||
DistinguishedName base = tested.getBase();
|
||||
assertNotNull(base);
|
||||
assertEquals(new DistinguishedName("dc=jayway,dc=se"), base);
|
||||
assertEquals(new DistinguishedName("dc=261consulting,dc=com"), base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.ldap.itest.core.support;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
@@ -26,6 +27,7 @@ import org.springframework.ldap.core.simple.AbstractParameterizedContextMapper;
|
||||
import org.springframework.ldap.core.support.LdapContextSource;
|
||||
import org.springframework.ldap.filter.EqualsFilter;
|
||||
import org.springframework.ldap.itest.AbstractLdapTemplateIntegrationTest;
|
||||
import org.springframework.ldap.repository.Query;
|
||||
import org.springframework.ldap.support.LdapUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -50,6 +52,7 @@ import static junit.framework.Assert.fail;
|
||||
public class LdapContextSourceIntegrationTest extends AbstractLdapTemplateIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("contextSource")
|
||||
private ContextSource tested;
|
||||
|
||||
@Autowired
|
||||
@@ -63,7 +66,7 @@ public class LdapContextSourceIntegrationTest extends AbstractLdapTemplateIntegr
|
||||
ctx = tested.getReadOnlyContext();
|
||||
assertNotNull(ctx);
|
||||
Hashtable environment = ctx.getEnvironment();
|
||||
assertTrue(environment.containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG));
|
||||
assertFalse(environment.containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_PRINCIPAL));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_CREDENTIALS));
|
||||
}
|
||||
@@ -89,7 +92,7 @@ public class LdapContextSourceIntegrationTest extends AbstractLdapTemplateIntegr
|
||||
assertNotNull(ctx);
|
||||
// Double check to see that we are authenticated.
|
||||
Hashtable environment = ctx.getEnvironment();
|
||||
assertTrue(environment.containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG));
|
||||
assertFalse(environment.containsKey(LdapContextSource.SUN_LDAP_POOLING_FLAG));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_PRINCIPAL));
|
||||
assertTrue(environment.containsKey(Context.SECURITY_CREDENTIALS));
|
||||
}
|
||||
@@ -110,7 +113,7 @@ public class LdapContextSourceIntegrationTest extends AbstractLdapTemplateIntegr
|
||||
public void testGetContext() throws NamingException {
|
||||
DirContext ctx = null;
|
||||
try {
|
||||
String expectedPrincipal = "cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se";
|
||||
String expectedPrincipal = "cn=Some Person,ou=company1,c=Sweden," + base;
|
||||
String expectedCredentials = "password";
|
||||
ctx = tested.getContext(expectedPrincipal, expectedCredentials);
|
||||
assertNotNull(ctx);
|
||||
|
||||
@@ -50,81 +50,81 @@ public class LdapTemplateOdmGroupManipulationITest extends AbstractLdapTemplateI
|
||||
assertEquals(5, group.getMembers().size());
|
||||
|
||||
Set<Name> members = group.getMembers();
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base)));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person2,ou=company1,c=Sweden," + base)));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Norway," + base)));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company2,c=Sweden," + base)));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person3,ou=company1,c=Sweden," + base)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMember() {
|
||||
Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.removeMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se"));
|
||||
group.removeMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base));
|
||||
tested.update(group);
|
||||
|
||||
Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
Set<Name> members = verification.getMembers();
|
||||
assertEquals(4, members.size());
|
||||
assertFalse(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertFalse(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMemberSyntacticallyEqual() {
|
||||
Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.removeMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden, DC=jayway,DC=se"));
|
||||
group.removeMember(LdapUtils.newLdapName("cn=Some Person,OU=company1, C=Sweden," + base));
|
||||
tested.update(group);
|
||||
|
||||
Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
Set<Name> members = verification.getMembers();
|
||||
assertEquals(4, members.size());
|
||||
assertFalse(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertFalse(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMember() {
|
||||
Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.addMember(LdapUtils.newLdapName("cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se"));
|
||||
group.addMember(LdapUtils.newLdapName("cn=Some Person+sn=Person,ou=company1,c=Norway," + base));
|
||||
tested.update(group);
|
||||
|
||||
Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
Set<Name> members = verification.getMembers();
|
||||
assertEquals(6, members.size());
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person+sn=Person,ou=company1,c=Norway," + base)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMemberDuplicate() {
|
||||
Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.addMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se"));
|
||||
group.addMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base));
|
||||
tested.update(group);
|
||||
|
||||
Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
Set<Name> members = verification.getMembers();
|
||||
assertEquals(5, members.size());
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMemberSyntacticallyEqualDuplicate() {
|
||||
Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.addMember(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,DC=jayway,DC=se"));
|
||||
group.addMember(LdapUtils.newLdapName("cn=Some Person,OU=company1 ,C=Sweden," + base));
|
||||
tested.update(group);
|
||||
|
||||
Group verification = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
Set<Name> members = verification.getMembers();
|
||||
assertEquals(5, members.size());
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -132,8 +132,8 @@ public class LdapTemplateOdmGroupManipulationITest extends AbstractLdapTemplateI
|
||||
Group group = tested.findOne(query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.setMembers(new HashSet<Name>(){{
|
||||
add(LdapUtils.newLdapName("CN=Some Person,OU=company1, C=Sweden, DC=jayway,DC=se"));
|
||||
add(LdapUtils.newLdapName("CN=Some Person2, OU=company1,C=Sweden,DC=jayway, DC=se"));
|
||||
add(LdapUtils.newLdapName("CN=Some Person,OU=company1, C=Sweden, " + base));
|
||||
add(LdapUtils.newLdapName("CN=Some Person2, OU=company1,C=Sweden," + base));
|
||||
}});
|
||||
tested.update(group);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class LdapTemplateOdmGroupManipulationITest extends AbstractLdapTemplateI
|
||||
Set<Name> members = verification.getMembers();
|
||||
|
||||
assertEquals(2, members.size());
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se")));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person,ou=company1,c=Sweden," + base)));
|
||||
assertTrue(members.contains(LdapUtils.newLdapName("cn=Some Person2,ou=company1,c=Sweden," + base)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class RepositoryScanITest extends AbstractLdapTemplateIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void verifyThatFindOneWithNonexistingDnReturnsNull() {
|
||||
Person person = tested.findOne(LdapUtils.newLdapName("dn=unknown"));
|
||||
Person person = tested.findOne(LdapUtils.newLdapName("cn=unknown"));
|
||||
assertNull(person);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This context automatically starts the Apache Directory Server
|
||||
and sets up the test data
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<!-- Used mainly to enable injecting base into LdapServerManager -->
|
||||
<bean
|
||||
class="org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor" />
|
||||
|
||||
<!-- JNDI environment variable -->
|
||||
<bean id="environment"
|
||||
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||
<property name="properties">
|
||||
<props>
|
||||
<prop key="java.naming.security.authentication">
|
||||
simple
|
||||
</prop>
|
||||
<prop key="java.naming.security.principal">
|
||||
${userDn}
|
||||
</prop>
|
||||
<prop key="java.naming.security.credentials">
|
||||
${password}
|
||||
</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
Note the non-standard port, in order to leave 389 unused, thus
|
||||
making it easier for the integration tests requiring OpenLDAP.
|
||||
-->
|
||||
<bean id="configuration" class="org.apache.directory.server.configuration.MutableServerStartupConfiguration">
|
||||
<property name="ldapPort" value="1888" />
|
||||
<property name="contextPartitionConfigurations">
|
||||
<set>
|
||||
<ref bean="jaywayPartitionConfiguration"/>
|
||||
</set>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="jaywayPartitionConfiguration"
|
||||
class="org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration">
|
||||
<property name="name" value="jayway" />
|
||||
<property name="suffix" value="dc=jayway,dc=se" />
|
||||
<property name="contextEntry">
|
||||
<value>
|
||||
objectClass: top
|
||||
objectClass: domain
|
||||
objectClass: extensibleObject
|
||||
dc: jayway
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="configEnvHelper" class="org.springframework.ldap.ConfigEnvHelper">
|
||||
<constructor-arg ref="environment" />
|
||||
<constructor-arg ref="configuration" />
|
||||
</bean>
|
||||
|
||||
<bean name="serverContext" class="javax.naming.InitialContext">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
|
||||
<property name="targetObject" ref="configEnvHelper" />
|
||||
<property name="propertyPath" value="env" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean name="ldapServerManager" class="org.springframework.ldap.LdapServerManager">
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
|
||||
<!-- Custom editors required to launch ApacheDS -->
|
||||
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
||||
<property name="customEditors">
|
||||
<map>
|
||||
<entry key="javax.naming.directory.Attributes">
|
||||
<bean class="org.apache.directory.server.core.configuration.AttributesPropertyEditor"/>
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<bean id="contextSource2"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="cn=john doe, ${base}" />
|
||||
@@ -31,8 +31,8 @@
|
||||
</bean>
|
||||
|
||||
<bean id="dummyBaseContextAware"
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor">
|
||||
<property name="baseLdapPathSourceName" value="contextSource2" />
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<bean id="contextSource2"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
@@ -31,8 +31,8 @@
|
||||
</bean>
|
||||
|
||||
<bean id="dummyBaseContextAware"
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor" />
|
||||
</beans>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
@@ -21,8 +21,8 @@
|
||||
</bean>
|
||||
|
||||
<bean id="dummyBaseContextAware"
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor">
|
||||
<property name="basePath" value="cn=john doe"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="urls" value="${urls}" />
|
||||
<property name="urls" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="base" value="${base}" />
|
||||
@@ -26,8 +26,8 @@
|
||||
</bean>
|
||||
|
||||
<bean id="dummyBaseContextAware"
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
class="org.springframework.ldap.itest.core.support.DummyBaseLdapPathAware" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor" />
|
||||
</beans>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ldap="http://www.springframework.org/schema/ldap"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
|
||||
<beans profile="default">
|
||||
<ldap:context-source id="contextSource"
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="${base}" />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="${base}" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
<beans profile="no-apacheds">
|
||||
<ldap:context-source url="ldap://localhost:389"
|
||||
base="${base}"
|
||||
username="${userDn}"
|
||||
password="${password}"/>
|
||||
</beans>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<beans profile="default">
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="${base}" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="pooled" value="false" />
|
||||
</bean>
|
||||
</beans>
|
||||
<beans profile="no-apacheds">
|
||||
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="base" value="${base}" />
|
||||
<property name="url" value="${url}" />
|
||||
<property name="userDn" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
</beans>
|
||||
@@ -1,16 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<!--
|
||||
This context configuration file defines common beans,
|
||||
minimizing duplication in the various test context files.
|
||||
-->
|
||||
|
||||
<bean id="placeholderConfig"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="location" value="classpath:/conf/ldap.properties" />
|
||||
</bean>
|
||||
<context:property-placeholder location="classpath:/conf/ldap.properties" system-properties-mode="OVERRIDE" />
|
||||
</beans>
|
||||
|
||||
@@ -6,19 +6,9 @@
|
||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="pooled" value="false" />
|
||||
</bean>
|
||||
|
||||
<sec:ldap-server url="${urls}" />
|
||||
<sec:ldap-server url="${url}" />
|
||||
<sec:authentication-manager>
|
||||
<sec:ldap-authentication-provider
|
||||
group-search-filter="member={0}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
urls=ldap://127.0.0.1:1888
|
||||
url=ldap://127.0.0.1:389
|
||||
userDn=uid=admin,ou=system
|
||||
password=secret
|
||||
base=dc=jayway,dc=se
|
||||
base=dc=261consulting,dc=com
|
||||
testRoot=
|
||||
|
||||
@@ -3,23 +3,10 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:ldap="http://www.springframework.org/schema/ldap"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<ldap:context-source id="contextSource"
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<ldap:ldap-template id="ldapTemplate"/>
|
||||
|
||||
|
||||
@@ -2,20 +2,10 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="pooled" value="false" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonNoNamespaceContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="dataSource"
|
||||
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||
|
||||
@@ -21,20 +21,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<ldap:context-source id="contextSource"
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<ldap:ldap-template id="ldapTemplate"/>
|
||||
|
||||
|
||||
@@ -4,17 +4,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="pooled" value="false" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonNoNamespaceContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="dataSource"
|
||||
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<bean id="contextSource2" class="org.springframework.ldap.core.support.LdapContextSource" >
|
||||
<property name="urls" value="ldap://127.0.0.1:389,ldap://127.0.0.2:389" />
|
||||
<property name="userDn" value="cn=dummy" />
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="authenticationSource">
|
||||
<bean
|
||||
class="org.springframework.ldap.authentication.AcegiAuthenticationSource" />
|
||||
</property>
|
||||
<property name="baseOnTarget" value="false" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
|
||||
<bean id="initialDirContextFactory"
|
||||
class="org.acegisecurity.ldap.DefaultInitialDirContextFactory">
|
||||
<constructor-arg value="${urls}/${base}" />
|
||||
<property name="managerDn" value="${userDn}" />
|
||||
<property name="managerPassword" value="${password}" />
|
||||
</bean>
|
||||
|
||||
<bean id="userSearch"
|
||||
class="org.acegisecurity.ldap.search.FilterBasedLdapUserSearch">
|
||||
<constructor-arg index="0">
|
||||
<value></value>
|
||||
</constructor-arg>
|
||||
<constructor-arg index="1"
|
||||
value="(&(cn={0})(objectclass=person))" />
|
||||
<constructor-arg index="2" ref="initialDirContextFactory" />
|
||||
<property name="searchSubtree" value="true" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapAuthProvider"
|
||||
class="org.acegisecurity.providers.ldap.LdapAuthenticationProvider">
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="org.acegisecurity.providers.ldap.authenticator.BindAuthenticator">
|
||||
<constructor-arg ref="initialDirContextFactory" />
|
||||
<property name="userSearch" ref="userSearch" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg>
|
||||
<bean
|
||||
class="org.acegisecurity.providers.ldap.populator.DefaultLdapAuthoritiesPopulator">
|
||||
<constructor-arg ref="initialDirContextFactory" />
|
||||
<constructor-arg value="c=Sweden" />
|
||||
<property name="groupRoleAttribute" value="ou" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -4,20 +4,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<ldap:ldap-template />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -6,20 +6,7 @@
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<ldap:ldap-template />
|
||||
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ldap="http://www.springframework.org/schema/ldap"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="baseOnTarget" value="false" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="dataLoader" class="org.ddsteps.data.excel.CachingExcelDataLoader" />
|
||||
-->
|
||||
|
||||
<beans profile="default">
|
||||
<ldap:context-source id="contextSource"
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"/>
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="${base}" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
<property name="baseOnTarget" value="false" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
<beans profile="no-apacheds">
|
||||
<ldap:context-source url="ldap://localhost:389"
|
||||
username="${userDn}"
|
||||
password="${password}"/>
|
||||
</beans>
|
||||
</beans>
|
||||
@@ -22,10 +22,10 @@
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
password="secret"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se">
|
||||
username="uid=admin,ou=system"
|
||||
base="dc=261consulting,dc=com">
|
||||
|
||||
<ldap:pooling
|
||||
max-active="1"
|
||||
|
||||
@@ -2,21 +2,12 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
</bean>
|
||||
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -5,17 +5,7 @@
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data_subtree.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="pooled" value="false" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonNoNamespaceContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="transactedContextSource"
|
||||
class="org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy">
|
||||
|
||||
@@ -5,17 +5,7 @@
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<import resource="classpath:/conf/commonTestContext.xml"/>
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="pooled" value="false" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonNoNamespaceContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="transactedContextSource"
|
||||
class="org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy">
|
||||
|
||||
@@ -5,22 +5,9 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<ldap:ldap-template />
|
||||
|
||||
<context:component-scan base-package="org.springframework.ldap.itest.config" />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -4,21 +4,8 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<ldap:context-source
|
||||
password="${password}"
|
||||
url="ldap://localhost:1888"
|
||||
username="${userDn}"
|
||||
base="dc=jayway,dc=se" />
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<ldap:ldap-template />
|
||||
<ldap:repositories base-package="org.springframework.ldap.itest.repositories" />
|
||||
|
||||
<bean id="dummy" class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="contextSource" ref="contextSource" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ldap="http://www.springframework.org/schema/ldap"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<!-- note that this has no base set, since we want to get at the root entry -->
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="baseOnTarget" value="false" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="ldapTemplate"
|
||||
class="org.springframework.ldap.core.LdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
|
||||
<beans profile="default">
|
||||
<!-- note that this has no base set, since we want to get at the root entry -->
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="${base}" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="port" value="1888" />
|
||||
<property name="baseOnTarget" value="false" />
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
<beans profile="no-apacheds">
|
||||
<ldap:context-source url="ldap://localhost:389"
|
||||
username="${userDn}"
|
||||
password="${password}"/>
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -4,23 +4,11 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
<import resource="classpath:/conf/commonTestContext.xml" />
|
||||
|
||||
<bean id="contextSource"
|
||||
class="org.springframework.ldap.test.TestContextSourceFactoryBean">
|
||||
<property name="defaultPartitionSuffix" value="dc=jayway,dc=se" />
|
||||
<property name="defaultPartitionName" value="jayway" />
|
||||
<property name="principal" value="${userDn}" />
|
||||
<property name="password" value="${password}" />
|
||||
<property name="ldifFile" value="classpath:/setup_data.ldif" />
|
||||
<property name="port" value="1888" />
|
||||
</bean>
|
||||
<import resource="classpath:/conf/commonContextSourceConfig.xml"/>
|
||||
|
||||
<bean id="simpleLdapTemplate"
|
||||
class="org.springframework.ldap.core.simple.SimpleLdapTemplate">
|
||||
<constructor-arg ref="contextSource" />
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
<bean id="dataLoader" class="org.ddsteps.data.excel.CachingExcelDataLoader" />
|
||||
-->
|
||||
</beans>
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
dn: ou=groups,dc=jayway,dc=se
|
||||
dn: ou=groups,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: groups
|
||||
|
||||
dn: cn=ROLE_USER,ou=groups,dc=jayway,dc=se
|
||||
dn: cn=ROLE_USER,ou=groups,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_USER
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=jayway,dc=se
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_ADMIN
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
|
||||
dn: c=Sweden,dc=jayway,dc=se
|
||||
dn: c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Sweden
|
||||
description: The country of Sweden
|
||||
|
||||
dn: c=Norway,dc=jayway,dc=se
|
||||
dn: c=Norway,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Norway
|
||||
description: The country of Norway
|
||||
|
||||
dn: ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Sweden
|
||||
|
||||
dn: ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
dn: ou=company2,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company2
|
||||
description: Second company in Sweden
|
||||
|
||||
dn: ou=company1,c=Norway,dc=jayway,dc=se
|
||||
dn: ou=company1,c=Norway,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Norway
|
||||
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -61,7 +61,7 @@ sn: Person
|
||||
description: Sweden, Company1, Some Person
|
||||
telephoneNumber: +46 555-123456
|
||||
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -73,7 +73,7 @@ sn: Person2
|
||||
description: Sweden, Company1, Some Person2
|
||||
telephoneNumber: +46 555-654321
|
||||
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -85,7 +85,7 @@ sn: Person3
|
||||
description: Sweden, Company1, Some Person3
|
||||
telephoneNumber: +46 555-123654
|
||||
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -97,7 +97,7 @@ sn: Person
|
||||
description: Sweden, Company2, Some Person
|
||||
telephoneNumber: +46 555-456321
|
||||
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
dn: ou=groups,dc=jayway,dc=se
|
||||
dn: ou=groups,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: groups
|
||||
|
||||
dn: cn=ROLE_USER,ou=groups,dc=jayway,dc=se
|
||||
dn: cn=ROLE_USER,ou=groups,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_USER
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=261consulting,dc=com
|
||||
uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=jayway,dc=se
|
||||
dn: cn=ROLE_ADMIN,ou=groups,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: groupOfUniqueNames
|
||||
cn: ROLE_ADMIN
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
|
||||
dn: ou=temp,dc=jayway,dc=se
|
||||
dn: ou=temp,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: temp
|
||||
description: temp entry renaming node
|
||||
|
||||
dn: c=Sweden,dc=jayway,dc=se
|
||||
dn: c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Sweden
|
||||
description: The country of Sweden
|
||||
|
||||
dn: c=Norway,dc=jayway,dc=se
|
||||
dn: c=Norway,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: country
|
||||
c: Norway
|
||||
description: The country of Norway
|
||||
|
||||
dn: ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Sweden
|
||||
|
||||
dn: ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
dn: ou=company2,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company2
|
||||
description: Second company in Sweden
|
||||
|
||||
dn: ou=company1,c=Norway,dc=jayway,dc=se
|
||||
dn: ou=company1,c=Norway,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: organizationalUnit
|
||||
ou: company1
|
||||
description: First company in Norway
|
||||
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -67,7 +67,7 @@ sn: Person
|
||||
description: Sweden, Company1, Some Person
|
||||
telephoneNumber: +46 555-123456
|
||||
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person2,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -79,7 +79,7 @@ sn: Person2
|
||||
description: Sweden, Company1, Some Person2
|
||||
telephoneNumber: +46 555-654321
|
||||
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person3,ou=company1,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -91,7 +91,7 @@ sn: Person3
|
||||
description: Sweden, Company1, Some Person3
|
||||
telephoneNumber: +46 555-123654
|
||||
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
|
||||
dn: cn=Some Person,ou=company2,c=Sweden,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
@@ -103,7 +103,7 @@ sn: Person
|
||||
description: Sweden, Company2, Some Person
|
||||
telephoneNumber: +46 555-456321
|
||||
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se
|
||||
dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=261consulting,dc=com
|
||||
objectclass: top
|
||||
objectclass: person
|
||||
objectclass: organizationalPerson
|
||||
|
||||
Reference in New Issue
Block a user