mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-12 21:33:30 +00:00
SEC-836: Made LDAP namespace elements use subtree group searching by default.
This commit is contained in:
parent
871e529840
commit
45c3084502
@ -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)) {
|
||||||
|
@ -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)
|
||||||
|
@ -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")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user