You usually do this with a UserDetailsService . UserDetailsService is a DAO used to load user information when trying to log in. Take a look at the loadUserByUsername(String username) method and the UserDetails class in spring.
I need to define it in your context:
<bean id="myDetailsService" class="com.company.service.impl.MyDetailsService" />
To use it, you can add this to your security configuration:
<authentication-manager> <authentication-provider user-service-ref="myDetailsService" /> </authentication-manager>
and all your security filters will use it.
You can ask a more specific question if you need help implementing it, but you will not have problems with IMO.
source share