diff --git a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java index c2faef6189..620c424c0e 100644 --- a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerBeanDefinitionParser.java @@ -21,12 +21,11 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.util.Assert; import org.springframework.util.StringUtils; +import org.springframework.util.xml.DomUtils; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import com.sun.tools.internal.xjc.util.DOMUtils; - /** * Registers the central ProviderManager used by the namespace configuration, and allows the configuration of an * alias, allowing users to reference it in their beans and clearly see where the name is @@ -58,9 +57,12 @@ public class AuthenticationManagerBeanDefinitionParser implements BeanDefinition if (node instanceof Element) { Element providerElt = (Element)node; if (StringUtils.hasText(providerElt.getAttribute(ATT_REF))) { - if (DOMUtils.getChildElements(providerElt).length > 0) { - pc.getReaderContext().error("authentication-provider element cannot have children when used " + - "with 'ref' atribute", pc.extractSource(element)); + NodeList providerChildren = providerElt.getChildNodes(); + for (int j = 0; j < providerChildren.getLength(); j++) { + if (providerChildren.item(j) instanceof Element) { + pc.getReaderContext().error("authentication-provider element cannot have child elements when used " + + "with 'ref' attribute", pc.extractSource(element)); + } } providers.add(new RuntimeBeanReference(providerElt.getAttribute(ATT_REF))); } else { diff --git a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java index 679a06b6d1..d99d146a93 100644 --- a/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/authentication/AuthenticationProviderBeanDefinitionParserTests.java @@ -135,7 +135,7 @@ public class AuthenticationProviderBeanDefinitionParserTests { public void exernalProviderDoesNotSupportChildElements() throws Exception { appContext = new InMemoryXmlApplicationContext( " " + - " " + + " " + " " + " " + " " +