Reputation: 197
Is there a way to tell Spring to find the user's role in a custom user bean that I've made?
http://static.springsource.org/sprin...ns-config.html
So if I had a bean called UserDetails that had:
Using the authentication manager, could it point to the UserDetails bean to determine the user's role? If so, where would I define the UserDetails bean in the code below?
Also what is "myUserDetailsService"? Is that a reference to the bean below the auth-manager?
<authentication-manager>
<authentication-provider user-service-ref='myUserDetailsService'/>
</authentication-manager>
<beans:bean id="myUserDetailsService"
class="org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl">
<beans:property name="dataSource" ref="dataSource"/>
</beans:bean>
Upvotes: 3
Views: 1592
Reputation: 120851
myUserDetailsService
is the (not well choosen) id of an instance of the standart spring security bean: org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl
.
It is one of the default beans that can be used for authentication and authorization. It loads the user details including roles by simple sql statements from the data base.
If you want to have your own way to build a custom UserDetails
then you only need a bean that implements the UserDetailsService
interface. This bean the must be referenced by <authentication-provider user-service-ref
(instead of "myUserDetailsService").
@See Spring Security Reference, chapter 5.2.2 The UserDetailsService
Upvotes: 1