コード例 #1
0
ファイル: PasswordService.java プロジェクト: alecgonzales/otp
 private void validateListIsFree(OneTimePasswordList passwordList)
     throws OneTimePasswordListNotFreeException {
   if (!passwordList.isFree()) {
     throw new OneTimePasswordListNotFreeException(
         "Otp list with id " + passwordList.getId() + " is no longer free.");
   }
 }
コード例 #2
0
ファイル: PasswordService.java プロジェクト: alecgonzales/otp
 /**
  * Associates an otp list with a user.
  *
  * @return associated otp list
  */
 @Override
 public OneTimePasswordList associateOtpListWithUser(OneTimePasswordList passwordList, User user)
     throws OneTimePasswordListNotFreeException {
   validateListIsFree(passwordList);
   passwordList.setUser(user);
   passwordList.setStatus(statusDao.getByValue("associated"));
   passwordListDao.update(passwordList);
   return passwordList;
 }
コード例 #3
0
ファイル: PasswordService.java プロジェクト: alecgonzales/otp
 /**
  * Generates a list of one time passwords.
  *
  * @return list of one time passwords
  */
 @Override
 public OneTimePasswordList generatePasswordList(Date expiryDate) {
   OneTimePasswordList passwordList = new OneTimePasswordList();
   passwordList.setPasswords(generatePasswords());
   passwordList.setStatus(statusDao.getByValue("free"));
   passwordList.setSize(LIST_SIZE);
   passwordList.setExpires(expiryDate);
   passwordListDao.save(passwordList);
   return passwordList;
 }