1
0
mirror of synced 2026-08-06 02:08:01 +00:00

Fixed problem with relative name being used in (member={0}) search in DefaultAuthoritiesPopulator.

This commit is contained in:
Luke Taylor
2007-12-14 20:41:00 +00:00
parent 09f68400ec
commit 31c09896ea
5 changed files with 50 additions and 2 deletions
@@ -1,5 +1,10 @@
package org.springframework.security.config;
import org.springframework.security.providers.ProviderManager;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.providers.ldap.LdapAuthenticationProvider;
import org.springframework.security.Authentication;
import org.springframework.security.userdetails.ldap.LdapUserDetailsImpl;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
@@ -40,5 +45,17 @@ public class LdapBeanDefinitionParserTests {
LdapTemplate template = new LdapTemplate(idcf);
template.lookup("uid=ben,ou=people");
ProviderManager authManager = (ProviderManager) appContext.getBean(BeanIds.AUTHENTICATION_MANAGER);
assertEquals(1, authManager.getProviders().size());
LdapAuthenticationProvider provider = (LdapAuthenticationProvider) authManager.getProviders().get(0);
Authentication auth = provider.authenticate(new UsernamePasswordAuthenticationToken("ben", "benspassword"));
LdapUserDetailsImpl ben = (LdapUserDetailsImpl) auth.getPrincipal();
assertEquals(2, ben.getAuthorities().length);
}
}
@@ -50,6 +50,7 @@ public class PasswordComparisonAuthenticatorMockTests extends MockObjectTestCase
// mockCtx.expects(once()).method("lookup").with(eq("cn=Bob,ou=people")).will(returnValue(true));
mockCtx.expects(once()).method("getAttributes").with(eq("cn=Bob,ou=people"), NULL)
.will(returnValue(attrs));
mockCtx.expects(once()).method("getNameInNamespace").will(returnValue("dc=springframework,dc=org"));
// Setup a single return value (i.e. success)
Attributes searchResults = new BasicAttributes("", null);