SEC-648: Added custom-authentication-provider support.

This commit is contained in:
Luke Taylor 2008-01-27 13:31:34 +00:00
parent dbc901fba9
commit 82940db6c8
4 changed files with 36 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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";
}

View File

@ -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());
}
}

View File

@ -34,6 +34,16 @@
</http>
<beans:bean id="x509Filter" class="org.springframework.security.ui.preauth.x509.X509PreAuthenticatedProcessingFilter" autowire="byType">
<custom-filter after="X509_FILTER"/>
</beans:bean>
<beans:bean id="preauthProvider" class="org.springframework.security.providers.preauth.PreAuthenticatedAuthenticationProvider" >
<custom-authentication-provider />
<beans:property name="preAuthenticatedUserDetailsService">
<beans:bean class="org.springframework.security.providers.preauth.UserDetailsByNameServiceWrapper" autowire="byType"/>
</beans:property>
</beans:bean>
<!--
Usernames/Passwords are