コード例 #1
0
 @Override
 public User findUserByUsername(String username) {
   try {
     return userManager.findUserByUsername(username);
   } catch (Exception e) {
     throw new ManagerDataAccessException("Error while retrieving user", e);
   }
 }
コード例 #2
0
 @Override
 public User findUserById(Long userId) {
   try {
     return userManager.findUser(userId);
   } catch (Exception e) {
     throw new ManagerDataAccessException("Error while rtrieving user", e);
   }
 }
コード例 #3
0
 @Override
 public List<User> getAllUsers() {
   try {
     return userManager.findAllUsers();
   } catch (Exception e) {
     throw new ManagerDataAccessException("Error while rtrieving users", e);
   }
 }
コード例 #4
0
 @Override
 public void registerUser(User user, String unencryptedPassword) {
   user.setPassword(createHash(unencryptedPassword));
   try {
     user.setId(userManager.addUser(user));
   } catch (Exception e) {
     throw new ManagerDataAccessException("Error while registering user", e);
   }
 }
コード例 #5
0
 @Override
 public void changePassword(User user, String password, String newUnencryptedPassword) {
   if (authenticate(user, password)) {
     user.setPassword(createHash(newUnencryptedPassword));
     try {
       userManager.updateUser(user);
     } catch (Exception e) {
       throw new ManagerDataAccessException("Error while rtrieving users", e);
     }
   }
 }