コード例 #1
0
  @Override
  public String getDocumentAccess(Long nID_Access, String sSecret) throws Exception {
    Session oSession = getSession();

    DocumentAccess docAcc = new DocumentAccess();
    List<DocumentAccess> list = findAll();
    if (list == null || list.isEmpty()) {
      throw new Exception("Access not accepted!");
    } else {
      for (DocumentAccess da : list) {
        if (da.getId() == nID_Access && da.getSecret().equals(sSecret)) {
          docAcc = da;
          break;
        }
      }
    }
    String sTelephone = "";
    if (docAcc.getTelephone() != null) {
      sTelephone = docAcc.getTelephone();
    }
    String sAnswer = SecurityUtils.generateAnswer();
    docAcc.setAnswer(sAnswer);
    String otpPassword = getOtpPassword(docAcc);
    return otpPassword;
  }
コード例 #2
0
 @Override
 public DocumentAccess getDocumentLink(Long nID_Access, String sSecret) {
   Session oSession = getSession();
   List<DocumentAccess> list = null;
   DocumentAccess docAcc = null;
   try {
     list = (List<DocumentAccess>) oSession.createCriteria(DocumentAccess.class).list();
     for (DocumentAccess da : list) {
       if (da.getId() == nID_Access && da.getSecret().equals(sSecret)) {
         docAcc = da;
         break;
       }
     }
   } catch (Exception e) {
     throw e;
   }
   return docAcc;
 }