SEC-1145: Updated LDAP code to make sure pooling flag is removed when binding as a specific user (for real this time)

This commit is contained in:
Luke Taylor 2009-06-03 16:57:33 +00:00
parent b77f780993
commit 781c99f257

View File

@ -5,6 +5,7 @@ import static org.junit.Assert.assertNull;
import javax.naming.directory.DirContext;
import org.junit.Test;
import org.springframework.security.BadCredentialsException;
/**
* @author Luke Taylor
@ -30,4 +31,16 @@ public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegra
ctx.close();
}
@Test(expected=BadCredentialsException.class)
public void poolingIsntUsedForSingleUser2() throws Exception {
DirContext ctx = getContextSource().getReadWriteContext("uid=Bob,ou=people,dc=springframework,dc=org", "bobspassword");
com.sun.jndi.ldap.LdapPoolManager.showStats(System.out);
ctx.close();
com.sun.jndi.ldap.LdapPoolManager.showStats(System.out);
// Now get it gain, with wrong password
ctx = getContextSource().getReadWriteContext("uid=Bob,ou=people,dc=springframework,dc=org", "wrongpassword");
com.sun.jndi.ldap.LdapPoolManager.showStats(System.out);
}
}