Spring security and authentication provider
- by Pascal
I'm trying to implement Spring 3 Security in a project, but I can not get rid of the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'_authenticationManager': Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: No authentication providers were found in the
application context
This seems weird, as I did provide an authentication provider!
I've added these lines to web.
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
And this is my applicationContext-security.xml:
<http auto-config="false">
<intercept-url pattern="/**" access="ROLE_USER" />
<http-basic />
</http>
<authentication-manager alias="authenticationManager">
<authentication-provider>
<user-service>
<user name="jimi" password="jimispassword" authorities="ROLE_USER, ROLE_ADMIN"/>
<user name="bob" password="bobspassword" authorities="ROLE_USER"/>
</user-service>
</authentication-provider>
</authentication-manager>
Google couldn't help me much further, nor could the official documentation.