|
|
|
@ -28,7 +28,7 @@ import javax.naming.directory.DirContext; |
|
|
|
* @author Luke Taylor |
|
|
|
* @author Luke Taylor |
|
|
|
* @version $Id$ |
|
|
|
* @version $Id$ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class LdapTemplateTests extends AbstractLdapIntegrationTests { |
|
|
|
public class SpringSecurityLdapTemplateTests extends AbstractLdapIntegrationTests { |
|
|
|
//~ Instance fields ================================================================================================
|
|
|
|
//~ Instance fields ================================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
private SpringSecurityLdapTemplate template; |
|
|
|
private SpringSecurityLdapTemplate template; |
|
|
|
@ -75,7 +75,7 @@ public class LdapTemplateTests extends AbstractLdapIntegrationTests { |
|
|
|
} catch (UncategorizedLdapException expected) {} |
|
|
|
} catch (UncategorizedLdapException expected) {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void testSearchForSingleAttributeValues() { |
|
|
|
public void testRoleSearchReturnsCorrectNumberOfRoles() { |
|
|
|
String param = "uid=ben,ou=people,dc=acegisecurity,dc=org"; |
|
|
|
String param = "uid=ben,ou=people,dc=acegisecurity,dc=org"; |
|
|
|
|
|
|
|
|
|
|
|
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "ou"); |
|
|
|
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "ou"); |
|
|
|
@ -85,4 +85,12 @@ public class LdapTemplateTests extends AbstractLdapIntegrationTests { |
|
|
|
assertTrue(values.contains("manager")); |
|
|
|
assertTrue(values.contains("manager")); |
|
|
|
assertTrue(values.contains("submanager")); |
|
|
|
assertTrue(values.contains("submanager")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void testRoleSearchForMissingAttributeFailsGracefully() { |
|
|
|
|
|
|
|
String param = "uid=ben,ou=people,dc=acegisecurity,dc=org"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "mail"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals(0, values.size()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |