From 6a79cf7be23a814524c170e95eda11be431e2c69 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sat, 26 Jun 2010 16:07:23 +0100 Subject: [PATCH] SEC-1383: Make MethodSecurityMetadataSourceBeanDefinitionParser extend AbstractBeanDefinitionParser for automatic support of ID attribute. --- .../springframework/security/config/Elements.java | 2 +- ...ecurityMetadataSourceBeanDefinitionParser.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/Elements.java b/config/src/main/java/org/springframework/security/config/Elements.java index 48781aa645..0b48cd7c05 100644 --- a/config/src/main/java/org/springframework/security/config/Elements.java +++ b/config/src/main/java/org/springframework/security/config/Elements.java @@ -1,7 +1,7 @@ package org.springframework.security.config; /** - * Contains all the element names used by Spring Security 2 namespace support. + * Contains all the element names used by Spring Security 3 namespace support. * * @author Ben Alex */ diff --git a/config/src/main/java/org/springframework/security/config/method/MethodSecurityMetadataSourceBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/method/MethodSecurityMetadataSourceBeanDefinitionParser.java index 3379d43a4a..e11003eaa2 100644 --- a/config/src/main/java/org/springframework/security/config/method/MethodSecurityMetadataSourceBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/method/MethodSecurityMetadataSourceBeanDefinitionParser.java @@ -4,9 +4,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.BeanDefinitionParser; +import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.access.SecurityConfig; @@ -16,11 +16,16 @@ import org.springframework.util.StringUtils; import org.springframework.util.xml.DomUtils; import org.w3c.dom.Element; -public class MethodSecurityMetadataSourceBeanDefinitionParser implements BeanDefinitionParser { +/** + * + * @author Luke Taylor + * @since 3.1 + */ +public class MethodSecurityMetadataSourceBeanDefinitionParser extends AbstractBeanDefinitionParser { static final String ATT_METHOD = "method"; static final String ATT_ACCESS = "access"; - public BeanDefinition parse(Element elt, ParserContext pc) { + public AbstractBeanDefinition parseInternal(Element elt, ParserContext pc) { // Parse the included methods List methods = DomUtils.getChildElementsByTagName(elt, Elements.PROTECT); Map> mappings = new LinkedHashMap>(); @@ -32,7 +37,7 @@ public class MethodSecurityMetadataSourceBeanDefinitionParser implements BeanDef mappings.put(methodName, SecurityConfig.createList(tokens)); } - BeanDefinition metadataSource = new RootBeanDefinition(MapBasedMethodSecurityMetadataSource.class); + RootBeanDefinition metadataSource = new RootBeanDefinition(MapBasedMethodSecurityMetadataSource.class); metadataSource.getConstructorArgumentValues().addGenericArgumentValue(mappings); return metadataSource;