|
@@ -3,6 +3,8 @@ package org.springframework.security.config;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import org.apache.commons.logging.Log;
|
|
|
|
+import org.apache.commons.logging.LogFactory;
|
|
import org.springframework.beans.factory.config.BeanDefinition;
|
|
import org.springframework.beans.factory.config.BeanDefinition;
|
|
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
|
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
|
import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
|
|
import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
|
|
@@ -22,6 +24,7 @@ import org.springframework.security.config.ldap.LdapServerBeanDefinitionParser;
|
|
import org.springframework.security.config.ldap.LdapUserServiceBeanDefinitionParser;
|
|
import org.springframework.security.config.ldap.LdapUserServiceBeanDefinitionParser;
|
|
import org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser;
|
|
import org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser;
|
|
import org.springframework.security.config.method.InterceptMethodsBeanDefinitionDecorator;
|
|
import org.springframework.security.config.method.InterceptMethodsBeanDefinitionDecorator;
|
|
|
|
+import org.springframework.security.core.SpringSecurityCoreVersion;
|
|
import org.springframework.util.ClassUtils;
|
|
import org.springframework.util.ClassUtils;
|
|
import org.w3c.dom.Element;
|
|
import org.w3c.dom.Element;
|
|
import org.w3c.dom.Node;
|
|
import org.w3c.dom.Node;
|
|
@@ -34,10 +37,30 @@ import org.w3c.dom.Node;
|
|
* @since 2.0
|
|
* @since 2.0
|
|
*/
|
|
*/
|
|
public final class SecurityNamespaceHandler implements NamespaceHandler {
|
|
public final class SecurityNamespaceHandler implements NamespaceHandler {
|
|
|
|
+ private final Log logger = LogFactory.getLog(getClass());
|
|
|
|
+
|
|
private final Map<String, BeanDefinitionParser> parsers = new HashMap<String, BeanDefinitionParser>();
|
|
private final Map<String, BeanDefinitionParser> parsers = new HashMap<String, BeanDefinitionParser>();
|
|
private final BeanDefinitionDecorator interceptMethodsBDD = new InterceptMethodsBeanDefinitionDecorator();
|
|
private final BeanDefinitionDecorator interceptMethodsBDD = new InterceptMethodsBeanDefinitionDecorator();
|
|
private BeanDefinitionDecorator filterChainMapBDD;
|
|
private BeanDefinitionDecorator filterChainMapBDD;
|
|
|
|
|
|
|
|
+ public SecurityNamespaceHandler() {
|
|
|
|
+ String coreVersion = SpringSecurityCoreVersion.getVersion();
|
|
|
|
+
|
|
|
|
+ Package pkg = SpringSecurityCoreVersion.class.getPackage();
|
|
|
|
+
|
|
|
|
+ if (pkg == null || coreVersion == null) {
|
|
|
|
+ logger.info("Couldn't determine package version information.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String version = pkg.getImplementationVersion();
|
|
|
|
+ logger.info("Spring Security 'config' module version is " + version);
|
|
|
|
+
|
|
|
|
+ if (version.compareTo(coreVersion) != 0) {
|
|
|
|
+ logger.error("You are running with different versions of the Spring Security 'core' and 'config' modules");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public BeanDefinition parse(Element element, ParserContext pc) {
|
|
public BeanDefinition parse(Element element, ParserContext pc) {
|
|
if (!namespaceMatchesVersion(element)) {
|
|
if (!namespaceMatchesVersion(element)) {
|
|
pc.getReaderContext().fatal("You must use a 3.0 schema with Spring Security 3.0." +
|
|
pc.getReaderContext().fatal("You must use a 3.0 schema with Spring Security 3.0." +
|