Sample implementation. Inject your UserDao (or any other class that provides a way to retrieve user details) to this class and retrieve the user from it (inside retrieveUser method).
Code:
public class AuthenticationProvider extends
AbstractUserDetailsAuthenticationProvider {
@Override
public UserDetails retrieveUser(String userName,
UsernamePasswordAuthenticationToken authentication) {
// Add the logic that will retrieve the user details (user account
// statuses and granted authorities)
return null;
}
@Override
protected void additionalAuthenticationChecks(
org.springframework.security.core.userdetails.UserDetails userDetails,
UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
// Add any additional checks of a returned UserDetails
}
}
Extending AbstractUserDetailsAuthenticationProvider saves you from not implementing supports method