mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-29 15:22:15 +00:00
Remove default constructor as class is now only responsible for group searches which need the args version.
This commit is contained in:
parent
30d878b22e
commit
f546e2bbad
@ -139,15 +139,6 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
|
||||
|
||||
//~ Constructors ===========================================================
|
||||
|
||||
/**
|
||||
* Constructor for non-group search scenarios. Typically in this case
|
||||
* the <tt>userRoleAttributes</tt> property will be set to obtain roles directly
|
||||
* from the user's directory entry attributes. The <tt>defaultRole</tt> property
|
||||
* may also be set and will be assigned to all users.
|
||||
*/
|
||||
public DefaultLdapAuthoritiesPopulator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for group search scenarios. <tt>userRoleAttributes</tt> may still be
|
||||
* set as a property.
|
||||
|
@ -44,11 +44,11 @@ public class DefaultLdapAuthoritiesPopulatorTests extends AbstractLdapServerTest
|
||||
// }
|
||||
|
||||
public void testDefaultRoleIsAssignedWhenSet() {
|
||||
DefaultLdapAuthoritiesPopulator populator = new DefaultLdapAuthoritiesPopulator();
|
||||
DefaultLdapAuthoritiesPopulator populator = new DefaultLdapAuthoritiesPopulator(getInitialCtxFactory(), "ou=groups");
|
||||
populator.setDefaultRole("ROLE_USER");
|
||||
LdapUserDetailsImpl.Essence user = new LdapUserDetailsImpl.Essence();
|
||||
user.setDn("Ignored");
|
||||
user.setUsername("Ignored");
|
||||
user.setDn("cn=notfound");
|
||||
user.setUsername("notfound");
|
||||
user.setAttributes(new BasicAttributes());
|
||||
|
||||
GrantedAuthority[] authorities =
|
||||
@ -57,7 +57,7 @@ public class DefaultLdapAuthoritiesPopulatorTests extends AbstractLdapServerTest
|
||||
assertEquals("ROLE_USER", authorities[0].getAuthority());
|
||||
}
|
||||
|
||||
public void testGroupSearch() throws Exception {
|
||||
public void testGroupSearchReturnsExpectedRoles() {
|
||||
DefaultLdapAuthoritiesPopulator populator =
|
||||
new DefaultLdapAuthoritiesPopulator(getInitialCtxFactory(), "ou=groups");
|
||||
populator.setRolePrefix("ROLE_");
|
||||
|
Loading…
x
Reference in New Issue
Block a user