In simplest terms, how do I register custom AuthenticationProviders for spring-security-2.x?
I'm working with some recent snapshot of spring-webflow-samples/booking-mvc as my starting point, I'm using spring-security-2.0.0-RC1, and I'm struggling with authentication. I'm new to Acegi, so please bear with me. I've commented out the sample "security:authentication-provider" element, and am trying instead to configure a ProviderManager authenticationManager bean. All of my iterations are at best resulting in the following error:
For some background: I didn't have any problems building and running the sample application: I was able to authenticate using the sample security:authentication-provider as provided. I also didn't have any problems hooking my backend in through web-application-config.xml, and I've developed some controllers views which are successfully hitting my backend, producing the results I expect. In order to integrate with the legacy application I'm porting, I found it necessary to implement a custom AuthenticationProvider which extends AbstractUserDetailsAuthenticationProvider. I can't figure out how to configure spring-security to use this provider. Here are some relevant entries in my web-application-config.xml:Code:... ProviderNotFoundException: No AuthenticationProvider found for {0}
Notice that I've commented out the security:authentication-provider element because it appears to be hard-coded only to support DaoAuthenticationProvider. Also, the altered application wouldn't run until I implemented MyUserDetailsService, despite the fact the first iteration of my custom AuthenticationProvider didn't require one.Code:<bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager"> <property name="providers"> <list> <ref local="myAuthenticationProvider" /> </list> </property> </bean> <bean id="myUserDetailsService" class="com.myco.MyUserDetailsService"/> <bean id="myAuthenticationProvider" class="com.myco.MyAuthenticationProvider"/> <!-- Configure Spring Security --> <security:http auto-config="true"> <!-- restrict URLs based on role --> ... <!--<security:authentication-provider>
When I dump the list of beans defined in my application context before I make my changes and after I make my changes, I see the following beans are present in the case which works, and not present in the case which doesn't work:
Any clues? Is it folly to try to start with spring-security-2.x, rather than making something first work using Acegi-1.0.6?Code:org.springframework.security.providers.dao.DaoAuthenticationProvider#0 _userDetailsService org.springframework.security.config.AuthenticationProviderBeanDefinitionParser$AuthenticationProviderCacheResolver#0


.