Skip to content

Instantly share code, notes, and snippets.

@altfatterz
Created February 22, 2014 11:59
Show Gist options
  • Save altfatterz/9152846 to your computer and use it in GitHub Desktop.
Save altfatterz/9152846 to your computer and use it in GitHub Desktop.
public class UserDetailsServiceAdapter implements UserDetailsService {
@Autowired
private AccountRepository accountRepository;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
Account account = accountRepository.findByEmail(username);
if (account == null) {
throw new UsernameNotFoundException(username);
}
return new UserDetailsAdapter(account);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment