Some additional tests to confirm there are no issues with spaces in LDAP URL.
This commit is contained in:
parent
530f686149
commit
428991d997
|
@ -36,6 +36,7 @@ integrationTest {
|
||||||
systemProperties['apacheDSWorkDir'] = "${buildDir}/apacheDSWork"
|
systemProperties['apacheDSWorkDir'] = "${buildDir}/apacheDSWork"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Runs a server for running the integration tests against (from an IDE, for example)
|
||||||
task(ldapServer, dependsOn: 'integrationTestClasses', type: JavaExec) {
|
task(ldapServer, dependsOn: 'integrationTestClasses', type: JavaExec) {
|
||||||
classpath = sourceSets.integrationTest.runtimeClasspath
|
classpath = sourceSets.integrationTest.runtimeClasspath
|
||||||
main = 'org.springframework.security.ldap.ApacheDSServerIntegrationTests'
|
main = 'org.springframework.security.ldap.ApacheDSServerIntegrationTests'
|
||||||
|
|
|
@ -63,8 +63,16 @@ public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegra
|
||||||
// com.sun.jndi.ldap.LdapPoolManager.showStats(System.out);
|
// com.sun.jndi.ldap.LdapPoolManager.showStats(System.out);
|
||||||
// Now get it gain, with wrong password. Should fail.
|
// Now get it gain, with wrong password. Should fail.
|
||||||
ctx = getContextSource().getContext("uid=Bob,ou=people,dc=springframework,dc=org", "wrongpassword");
|
ctx = getContextSource().getContext("uid=Bob,ou=people,dc=springframework,dc=org", "wrongpassword");
|
||||||
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void serverUrlWithSpacesIsSupported() throws Exception {
|
||||||
|
DefaultSpringSecurityContextSource
|
||||||
|
contextSource = new DefaultSpringSecurityContextSource("ldap://127.0.0.1:53389/ou=space%20cadets,dc=springframework,dc=org");
|
||||||
|
contextSource.afterPropertiesSet();
|
||||||
|
contextSource.getContext("uid=space cadet,ou=space cadets,dc=springframework,dc=org", "spacecadetspassword");
|
||||||
|
}
|
||||||
|
|
||||||
static class EnvExposingDefaultSpringSecurityContextSource extends DefaultSpringSecurityContextSource {
|
static class EnvExposingDefaultSpringSecurityContextSource extends DefaultSpringSecurityContextSource {
|
||||||
public EnvExposingDefaultSpringSecurityContextSource(String providerUrl) {
|
public EnvExposingDefaultSpringSecurityContextSource(String providerUrl) {
|
||||||
|
|
|
@ -13,6 +13,11 @@ objectclass: top
|
||||||
objectclass: organizationalUnit
|
objectclass: organizationalUnit
|
||||||
ou: people
|
ou: people
|
||||||
|
|
||||||
|
dn: ou=space cadets,dc=springframework,dc=org
|
||||||
|
objectclass: top
|
||||||
|
objectclass: organizationalUnit
|
||||||
|
ou: space cadets
|
||||||
|
|
||||||
dn: ou=\"quoted people\",dc=springframework,dc=org
|
dn: ou=\"quoted people\",dc=springframework,dc=org
|
||||||
objectclass: top
|
objectclass: top
|
||||||
objectclass: organizationalUnit
|
objectclass: organizationalUnit
|
||||||
|
@ -83,6 +88,17 @@ sn: Quote
|
||||||
uid: quoteguy
|
uid: quoteguy
|
||||||
userPassword: quoteguyspassword
|
userPassword: quoteguyspassword
|
||||||
|
|
||||||
|
dn: uid=space cadet,ou=space cadets,dc=springframework,dc=org
|
||||||
|
objectclass: top
|
||||||
|
objectclass: person
|
||||||
|
objectclass: organizationalPerson
|
||||||
|
objectclass: inetOrgPerson
|
||||||
|
cn: Space Cadet
|
||||||
|
sn: Cadet
|
||||||
|
uid: space cadet
|
||||||
|
userPassword: spacecadetspassword
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dn: cn=developers,ou=groups,dc=springframework,dc=org
|
dn: cn=developers,ou=groups,dc=springframework,dc=org
|
||||||
objectclass: top
|
objectclass: top
|
||||||
|
|
Loading…
Reference in New Issue