From 8281aeb0dafb0a858f326d56059f25098720011d Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Tue, 29 Apr 2008 18:01:59 +0000 Subject: [PATCH] SEC-807: Allow mapping to a standard Ldap UserDetails through the namespace http://jira.springframework.org/browse/SEC-807. Added extra test for Ldap provider parser. --- ...LdapProviderBeanDefinitionParserTests.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/org/springframework/security/config/LdapProviderBeanDefinitionParserTests.java b/core/src/test/java/org/springframework/security/config/LdapProviderBeanDefinitionParserTests.java index 43c2761f07..a25bc8a86d 100644 --- a/core/src/test/java/org/springframework/security/config/LdapProviderBeanDefinitionParserTests.java +++ b/core/src/test/java/org/springframework/security/config/LdapProviderBeanDefinitionParserTests.java @@ -1,14 +1,18 @@ package org.springframework.security.config; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Test; +import org.springframework.security.Authentication; import org.springframework.security.providers.ProviderManager; import org.springframework.security.providers.UsernamePasswordAuthenticationToken; import org.springframework.security.providers.ldap.LdapAuthenticationProvider; -import org.springframework.security.Authentication; -import org.springframework.security.util.InMemoryXmlApplicationContext; +import org.springframework.security.userdetails.ldap.InetOrgPersonContextMapper; import org.springframework.security.userdetails.ldap.LdapUserDetailsImpl; -import static org.junit.Assert.*; -import org.junit.Test; -import org.junit.After; +import org.springframework.security.util.FieldUtils; +import org.springframework.security.util.InMemoryXmlApplicationContext; /** @@ -82,6 +86,15 @@ public class LdapProviderBeanDefinitionParserTests { ""); } + @Test + public void inetOrgContextMapperIsSupported() throws Exception { + setContext( + "" + + ""); + LdapAuthenticationProvider provider = getProvider(); + assertTrue(FieldUtils.getFieldValue(provider, "userDetailsContextMapper") instanceof InetOrgPersonContextMapper); + } + private void setContext(String context) { appCtx = new InMemoryXmlApplicationContext(context); }