mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-13 15:42:25 +00:00
SEC-1145: Updated LDAP code to make sure pooling flag is removed when binding as a specific user
This commit is contained in:
parent
22964837e9
commit
b77f780993
@ -71,6 +71,7 @@ public class DefaultSpringSecurityContextSource extends LdapContextSource implem
|
||||
|
||||
env.put(Context.SECURITY_PRINCIPAL, userDn);
|
||||
env.put(Context.SECURITY_CREDENTIALS, credentials);
|
||||
env.remove(SUN_LDAP_POOLING_FLAG);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating context with principal: '" + userDn + "'");
|
||||
|
@ -1,12 +1,16 @@
|
||||
package org.springframework.security.ldap;
|
||||
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import javax.naming.directory.DirContext;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Luke Taylor
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DefaultSpringSecurityContextSourceTests {
|
||||
public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void instantiationSucceeds() {
|
||||
@ -15,7 +19,15 @@ public class DefaultSpringSecurityContextSourceTests {
|
||||
|
||||
@Test
|
||||
public void supportsSpacesInUrl() {
|
||||
new DefaultSpringSecurityContextSource("ldap://myhost:10389/dc=spring%20framework,dc=org");
|
||||
new DefaultSpringSecurityContextSource("ldap://myhost:10389/dc=spring%20framework,dc=org");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void poolingIsntUsedForSingleUser() throws Exception {
|
||||
DirContext ctx = getContextSource().getReadWriteContext("uid=Bob,ou=people,dc=springframework,dc=org", "bobspassword");
|
||||
//com.sun.jndi.ldap.LdapPoolManager.showStats(System.out);
|
||||
assertNull(ctx.getEnvironment().get("com.sun.jndi.ldap.connect.pool"));
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user