How to configure spring security 2.0 to use a custom UserDetailsService?
I feel quite stupid for having to ask this, but I just wasn't getting anywhere with the docs and google...
How do I configure Spring Security to use my own UserDetailsService implementation? My UserDetailsService is defined in the normal Spring web app context config file (myappname-servlet.xml):
Code:
<bean id="userDetailsService" class="myappname.auth.UserDetailsServiceImpl">
<property name="dao">
<ref bean="testDao" />
</property>
</bean>
I also have another config file, applicationContext-security-ns.xml. In this file I have a simple security setup:
Code:
<http auto-config="true">
<intercept-url pattern="/secure/admin/**"
access="ROLE_ADMIN" />
<intercept-url pattern="/secure/**"
access="IS_AUTHENTICATED_REMEMBERED" />
<intercept-url pattern="/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<form-login login-page="/home.html" />
</http>
<authentication-provider>
<user-service>
<user name="user" password="user"
authorities="ROLE_ADMIN, ROLE_USER" />
</user-service>
</authentication-provider>
The simple authentication-provider works ok, but trying to refer to my own userDetailsService doesn't work. This has got to be very simple, could someone please show me how to do it?