Example #1
0
  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    // Load user from the database (throw exception if not found)
    User user = userDao.findByUsername(username);
    if (user == null) {
      throw new UsernameNotFoundException("User not found");
    }

    // Return user object
    return user;
  }
Example #2
0
 @Override
 public User findByUsername(String username) {
   return userDao.findByUsername(username);
 }