SEC-1137: Added support for an external UserDetailsContextMapper using the attribute user-context-mapper-ref.

This commit is contained in:
Luke Taylor
2009-06-08 23:35:05 +00:00
parent bfa2806034
commit 0473cfbfc0
5 changed files with 105 additions and 51 deletions

View File

@@ -141,6 +141,18 @@ public class LdapUserServiceBeanDefinitionParserTests {
assertTrue(ben instanceof InetOrgPerson);
}
@Test
public void externalContextMapperIsSupported() {
setContext(
"<ldap-server id='someServer'/>" +
"<ldap-user-service id='ldapUDS' user-search-filter='(uid={0})' user-context-mapper-ref='mapper'/>" +
"<b:bean id='mapper' class='"+ InetOrgPersonContextMapper.class.getName() +"'/>");
UserDetailsService uds = (UserDetailsService) appCtx.getBean("ldapUDS");
UserDetails ben = uds.loadUserByUsername("ben");
assertTrue(ben instanceof InetOrgPerson);
}
private void setContext(String context) {
appCtx = new InMemoryXmlApplicationContext(context);