protected final UserDetails retrieveUser(
final String username,
UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
EnMeUserAccount loadedUser;
try {
loadedUser = (EnMeUserAccount) this.getUserDetailsService().loadUserByUsername(
username);
} catch (UsernameNotFoundException notFound) {
throw notFound;
} catch (Exception repositoryProblem) {
throw new AuthenticationServiceException(
repositoryProblem.getMessage(), repositoryProblem);
}
if (loadedUser == null) {
throw new AuthenticationServiceException(
"UserDetailsService returned null, which is an interface contract violation");
}
log.debug("loaded user "+loadedUser.getUsername());
log.info("loader user "+loadedUser.toString());
return loadedUser;
}