private SecurityQuestionAnswerDTO checkIfQuestionisValidSingle( SecurityQuestionAnswerDTO questionIdentifier, SecurityQuestionDefinitionType securityQuestion) { if (securityQuestion .getIdentifier() .trim() .compareTo(questionIdentifier.getPwdQuestion().trim()) == 0) { questionIdentifier.setQuestionItself(securityQuestion.getQuestionText()); // LOGGER.info("\n\n: TRUE QUESTION"); return questionIdentifier; } else { return null; } }
private SecurityQuestionAnswerDTO checkIfQuestionisValid( SecurityQuestionAnswerDTO questionIdentifier, List<SecurityQuestionDefinitionType> securityQuestionList) { for (Iterator iterator = securityQuestionList.iterator(); iterator.hasNext(); ) { SecurityQuestionDefinitionType securityQuestionDefinitionType = (SecurityQuestionDefinitionType) iterator.next(); LOGGER.debug("List For" + securityQuestionDefinitionType.getIdentifier().trim()); if (securityQuestionDefinitionType .getIdentifier() .trim() .equalsIgnoreCase((questionIdentifier.getPwdQuestion().trim()))) { questionIdentifier.setQuestionItself(securityQuestionDefinitionType.getQuestionText()); LOGGER.info(": TRUE QUESTION"); return questionIdentifier; } else { return null; } } return null; }
/** * method for get existing questions and answer from user credentials * * @author oguzhan * @param userQuestionList * @param policyQuestionList * @param panelNumber */ public void executePasswordQuestionsAndAnswers( List<SecurityQuestionAnswerDTO> userQuestionList, List<SecurityQuestionDefinitionType> policyQuestionList, int panelNumber) { int userQuest = 0; LOGGER.debug("executePasswordQuestionsAndAnswers"); for (Iterator iterator = policyQuestionList.iterator(); iterator.hasNext(); ) { /* Loop for finding the Existing Questions * and Answers according to Policy*/ SecurityQuestionDefinitionType securityQuestionDefinitionType = (SecurityQuestionDefinitionType) iterator.next(); // user's question List loop to match the questions for (int i = userQuest; i < userQuestionList.size(); i++) { if (userQuestionList .get(i) .getPwdQuestion() .trim() .compareTo(securityQuestionDefinitionType.getIdentifier().trim()) == 0) { SecurityQuestionAnswerDTO a = new SecurityQuestionAnswerDTO( userQuestionList.get(i).getPwdQuestion(), userQuestionList.get(i).getPwdAnswer(), userQuestionList.get(i).getQuestionItself()); a = checkIfQuestionisValidSingle(a, securityQuestionDefinitionType); MyPasswordQuestionsPanel panel = new MyPasswordQuestionsPanel(ID_PASSWORD_QUESTIONS_PANEL + panelNumber, a); pqPanels.add(panel); panelNumber++; userQuest++; break; } else if (userQuestionList .get(i) .getPwdQuestion() .trim() .compareTo(securityQuestionDefinitionType.getIdentifier().trim()) != 0) { SecurityQuestionAnswerDTO a = new SecurityQuestionAnswerDTO( policyQuestionList.get(panelNumber).getIdentifier(), "", policyQuestionList.get(panelNumber).getQuestionText()); a.setQuestionItself(securityQuestionDefinitionType.getQuestionText()); userQuestionList .get(i) .setPwdQuestion(securityQuestionDefinitionType.getIdentifier().trim()); MyPasswordQuestionsPanel panel = new MyPasswordQuestionsPanel(ID_PASSWORD_QUESTIONS_PANEL + panelNumber, a); pqPanels.add(panel); panelNumber++; userQuest++; break; } } } }