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

Added default role option to authorities populator.

This commit is contained in:
Luke Taylor
2006-01-13 21:13:53 +00:00
parent bc7b0d00fe
commit 38629f159a
2 changed files with 30 additions and 2 deletions
@@ -43,6 +43,15 @@ public class DefaultLdapAuthoritiesPopulatorTests extends AbstractLdapServerTest
assertEquals("User should have three roles", 3, authorities.length);
}
public void testDefaultRoleIsAssignedWhenSet() {
DefaultLdapAuthoritiesPopulator populator = new DefaultLdapAuthoritiesPopulator();
populator.setDefaultRole("ROLE_USER");
GrantedAuthority[] authorities = populator.getGrantedAuthorities("Ignored", "Ignored", new BasicAttributes());
assertEquals(1, authorities.length);
assertEquals("ROLE_USER", authorities[0].getAuthority());
}
public void testGroupSearch() throws Exception {
DefaultLdapAuthoritiesPopulator populator = new DefaultLdapAuthoritiesPopulator(dirCtxFactory, "ou=groups");
populator.setRolePrefix("ROLE_");