How to link my custom authentication manager
Hi,
I'm currently developping a webapp with spring security 3.1 and hibernate jpa-2.0
Before I deal with hibernate in the authentication process, I tried with in-memory configuration like that
Code:
<!-- <authentication-manager alias="authenticationManager"> -->
<!-- <authentication-provider> -->
<!-- <user-service> -->
<!-- <user authorities="ROLE_USER" name="user" password="user"/> -->
<!-- <user authorities="ROLE_ADMIN" name="admin" password="admin"/> -->
<!-- <user authorities="ROLE_SM" name="sm" password="sm"/> -->
<!-- </user-service> -->
<!-- </authentication-provider> -->
<!-- </authentication-manager> -->
and it worked perfectly.
Now I want to use what is in my DB. I followed those instructions : http://stackoverflow.com/questions/2...with-hibernate
So I have a good "start-base".
I have the classes : Assembler and UserDetailsService UserDetailsService use my Dao.
in my project-security.xml I replaced the block above by
Code:
<beans:bean id="daoAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<beans:property name="userDetailsService" ref="userDetailsService"/>
</beans:bean>
<beans:bean id="authenticationManager"
class="org.springframework.security.authentication.ProviderManager">
<beans:property name="providers">
<beans:list>
<beans:ref local="daoAuthenticationProvider" />
</beans:list>
</beans:property>
</beans:bean>
<authentication-manager>
<authentication-provider user-service-ref="userDetailsService"/>
</authentication-manager>
but at the execution I get an exception about the filterChains bean :
Code:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#1' while setting bean property 'sourceList' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#1': Cannot create inner bean '(inner bean)' of type [org.springframework.security.web.authentication.logout.LogoutFilter] while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3': Cannot resolve reference to bean 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0': Cannot create inner bean '(inner bean)' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [org.springframework.security.core.userdetails.UserDetailsService org.springframework.security.config.http.UserDetailsServiceFactoryBean.cachingUserDetailsService(java.lang.String)] threw exception; nested exception is org.springframework.context.ApplicationContextException: No UserDetailsService registered.
and I have no clues what to do with it. I didn't modify something about the filterChain or something else.
Any ideas ?
thanks.