SEC-836: Made LDAP namespace elements use subtree group searching by default.

This commit is contained in:
Luke Taylor 2008-05-23 23:57:01 +00:00
parent 871e529840
commit 45c3084502
3 changed files with 5 additions and 4 deletions

View File

@ -123,6 +123,7 @@ public class LdapUserServiceBeanDefinitionParser extends AbstractUserDetailsServ
populator.addConstructorArg(parseServerReference(elt, parserContext)); populator.addConstructorArg(parseServerReference(elt, parserContext));
populator.addConstructorArg(groupSearchBase); populator.addConstructorArg(groupSearchBase);
populator.addPropertyValue("groupSearchFilter", groupSearchFilter); populator.addPropertyValue("groupSearchFilter", groupSearchFilter);
populator.addPropertyValue("searchSubtree", Boolean.TRUE);
if (StringUtils.hasText(rolePrefix)) { if (StringUtils.hasText(rolePrefix)) {
if ("none".equals(rolePrefix)) { if ("none".equals(rolePrefix)) {

View File

@ -38,7 +38,7 @@ public class LdapProviderBeanDefinitionParserTests {
Authentication auth = provider.authenticate(new UsernamePasswordAuthenticationToken("ben", "benspassword")); Authentication auth = provider.authenticate(new UsernamePasswordAuthenticationToken("ben", "benspassword"));
LdapUserDetailsImpl ben = (LdapUserDetailsImpl) auth.getPrincipal(); LdapUserDetailsImpl ben = (LdapUserDetailsImpl) auth.getPrincipal();
assertEquals(2, ben.getAuthorities().length); assertEquals(3, ben.getAuthorities().length);
} }
@Test(expected = SecurityConfigurationException.class) @Test(expected = SecurityConfigurationException.class)

View File

@ -42,7 +42,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
UserDetails ben = uds.loadUserByUsername("ben"); UserDetails ben = uds.loadUserByUsername("ben");
Set authorities = AuthorityUtils.authorityArrayToSet(ben.getAuthorities()); Set authorities = AuthorityUtils.authorityArrayToSet(ben.getAuthorities());
assertEquals(2, authorities.size()); assertEquals(3, authorities.size());
assertTrue(authorities.contains("ROLE_DEVELOPERS")); assertTrue(authorities.contains("ROLE_DEVELOPERS"));
} }
@ -88,7 +88,7 @@ public class LdapUserServiceBeanDefinitionParserTests {
UserDetails ben = uds.loadUserByUsername("ben"); UserDetails ben = uds.loadUserByUsername("ben");
Set authorities = AuthorityUtils.authorityArrayToSet(ben.getAuthorities()); Set authorities = AuthorityUtils.authorityArrayToSet(ben.getAuthorities());
assertEquals(2, authorities.size()); assertEquals(3, authorities.size());
assertTrue(authorities.contains(new GrantedAuthorityImpl("ROLE_DEVELOPER"))); assertTrue(authorities.contains(new GrantedAuthorityImpl("ROLE_DEVELOPER")));
} }