SEC-648: Added custom-authentication-provider support.
This commit is contained in:
parent
dbc901fba9
commit
82940db6c8
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,5 +29,6 @@ abstract class Elements {
|
||||||
public static final String SALT_SOURCE = "salt-source";
|
public static final String SALT_SOURCE = "salt-source";
|
||||||
public static final String PORT_MAPPINGS = "port-mappings";
|
public static final String PORT_MAPPINGS = "port-mappings";
|
||||||
public static final String PORT_MAPPING = "port-mapping";
|
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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,6 @@ public class SecurityNamespaceHandler extends NamespaceHandlerSupport {
|
||||||
registerBeanDefinitionDecorator(Elements.INTERCEPT_METHODS, new InterceptMethodsBeanDefinitionDecorator());
|
registerBeanDefinitionDecorator(Elements.INTERCEPT_METHODS, new InterceptMethodsBeanDefinitionDecorator());
|
||||||
registerBeanDefinitionDecorator(Elements.FILTER_CHAIN_MAP, new FilterChainMapBeanDefinitionDecorator());
|
registerBeanDefinitionDecorator(Elements.FILTER_CHAIN_MAP, new FilterChainMapBeanDefinitionDecorator());
|
||||||
registerBeanDefinitionDecorator(Elements.CUSTOM_FILTER, new OrderedFilterBeanDefinitionDecorator());
|
registerBeanDefinitionDecorator(Elements.CUSTOM_FILTER, new OrderedFilterBeanDefinitionDecorator());
|
||||||
|
registerBeanDefinitionDecorator(Elements.CUSTOM_AUTH_RPOVIDER, new CustomAuthenticationProviderBeanDefinitionDecorator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,16 @@
|
||||||
|
|
||||||
</http>
|
</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
|
Usernames/Passwords are
|
||||||
|
|
Loading…
Reference in New Issue