diff --git a/core/src/main/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecorator.java b/core/src/main/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecorator.java
new file mode 100644
index 0000000000..dc5a5e72dc
--- /dev/null
+++ b/core/src/main/java/org/springframework/security/config/CustomAuthenticationProviderBeanDefinitionDecorator.java
@@ -0,0 +1,23 @@
+package org.springframework.security.config;
+
+import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+
+import org.w3c.dom.Node;
+
+
+/**
+ * Adds the decorated {@link org.springframework.security.providers.AuthenticationProvider} to the ProviderManager's
+ * list.
+ *
+ * @author Luke Taylor
+ * @version $Id$
+ */
+public class CustomAuthenticationProviderBeanDefinitionDecorator implements BeanDefinitionDecorator {
+ public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder holder, ParserContext parserContext) {
+ ConfigUtils.getRegisteredProviders(parserContext).add(holder.getBeanDefinition());
+
+ return holder;
+ }
+}
diff --git a/core/src/main/java/org/springframework/security/config/Elements.java b/core/src/main/java/org/springframework/security/config/Elements.java
index b0f063df2c..fad646e10b 100644
--- a/core/src/main/java/org/springframework/security/config/Elements.java
+++ b/core/src/main/java/org/springframework/security/config/Elements.java
@@ -29,5 +29,6 @@ abstract class Elements {
public static final String SALT_SOURCE = "salt-source";
public static final String PORT_MAPPINGS = "port-mappings";
public static final String PORT_MAPPING = "port-mapping";
- public static final String CUSTOM_FILTER = "custom-filter";
+ public static final String CUSTOM_FILTER = "custom-filter";
+ public static final String CUSTOM_AUTH_RPOVIDER = "custom-authentication-provider";
}
diff --git a/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java b/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java
index 181e07037c..af175ce2ed 100644
--- a/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java
+++ b/core/src/main/java/org/springframework/security/config/SecurityNamespaceHandler.java
@@ -25,5 +25,6 @@ public class SecurityNamespaceHandler extends NamespaceHandlerSupport {
registerBeanDefinitionDecorator(Elements.INTERCEPT_METHODS, new InterceptMethodsBeanDefinitionDecorator());
registerBeanDefinitionDecorator(Elements.FILTER_CHAIN_MAP, new FilterChainMapBeanDefinitionDecorator());
registerBeanDefinitionDecorator(Elements.CUSTOM_FILTER, new OrderedFilterBeanDefinitionDecorator());
+ registerBeanDefinitionDecorator(Elements.CUSTOM_AUTH_RPOVIDER, new CustomAuthenticationProviderBeanDefinitionDecorator());
}
}
diff --git a/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml b/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml
index 67e0eb4c75..9d66912cc2 100644
--- a/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml
+++ b/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security-ns.xml
@@ -34,6 +34,16 @@
+
+
+
+
+
+
+
+
+
+