/** * Create an instance of {@link EncryptedSecurityAnswer } * */ public EncryptedSecurityAnswer createEncryptedSecurityAnswer() { return new EncryptedSecurityAnswer(); }
@Override public int hashCode() { int result = encryptedPassword != null ? encryptedPassword.hashCode() : 0; result = 31 * result + (securityQuestionId != null ? securityQuestionId.hashCode() : 0); result = 31 * result + (encryptedSecurityAnswer != null ? encryptedSecurityAnswer.hashCode() : 0); result = 31 * result + (encryptedVerificationCode != null ? encryptedVerificationCode.hashCode() : 0); return result; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof SecurityDetails)) { return false; } SecurityDetails that = (SecurityDetails) o; if (encryptedPassword != null ? !encryptedPassword.equals(that.encryptedPassword) : that.encryptedPassword != null) { return false; } if (encryptedSecurityAnswer != null ? !encryptedSecurityAnswer.equals(that.encryptedSecurityAnswer) : that.encryptedSecurityAnswer != null) { return false; } if (encryptedVerificationCode != null ? !encryptedVerificationCode.equals(that.encryptedVerificationCode) : that.encryptedVerificationCode != null) { return false; } if (securityQuestionId != null ? !securityQuestionId.equals(that.securityQuestionId) : that.securityQuestionId != null) { return false; } return true; }
.getSecurityQuestionId().getValue())); String encryptedAnswer = securityDetails.getEncryptedSecurityAnswer() != null ? securityDetails.getEncryptedSecurityAnswer().getContent() : null; profileEntity.setEncryptedSecurityAnswer(encryptedAnswer);
@Override public void updateSecurityQuestionInformation(OrcidProfile updatedOrcidProfile) { String orcid = updatedOrcidProfile.getOrcidIdentifier().getPath(); SecurityQuestionId securityQuestionId = updatedOrcidProfile.getOrcidInternal().getSecurityDetails().getSecurityQuestionId(); Integer questionId = null; if (securityQuestionId != null) { questionId = new Long(securityQuestionId.getValue()).intValue(); } String unencryptedAnswer = updatedOrcidProfile.getSecurityQuestionAnswer(); String encryptedAnswer = encrypt(unencryptedAnswer); profileDao.updateSecurityQuestion(orcid, questionId, questionId != null ? encryptedAnswer : null); OrcidProfile cachedProfile = orcidProfileCacheManager.retrieve(orcid); if (cachedProfile != null) { profileDao.flush(); SecurityDetails securityDetails = initSecurityDetails(cachedProfile); securityDetails.setSecurityQuestionId(questionId != null ? new SecurityQuestionId(questionId) : null); securityDetails.setEncryptedSecurityAnswer(encryptedAnswer != null ? new EncryptedSecurityAnswer(encryptedAnswer) : null); cachedProfile.setSecurityQuestionAnswer(encryptedAnswer != null ? unencryptedAnswer : null); orcidProfileCacheManager.put(cachedProfile); } }
securityDetails.setEncryptedPassword(profileEntity.getEncryptedPassword() != null ? new EncryptedPassword(profileEntity.getEncryptedPassword()) : null); securityDetails.setSecurityQuestionId(profileEntity.getSecurityQuestion() == null ? null : new SecurityQuestionId(profileEntity.getSecurityQuestion().getId())); securityDetails.setEncryptedSecurityAnswer(profileEntity.getEncryptedSecurityAnswer() != null ? new EncryptedSecurityAnswer(profileEntity .getEncryptedSecurityAnswer()) : null); securityDetails.setEncryptedVerificationCode(profileEntity.getEncryptedVerificationCode() != null ? new EncryptedVerificationCode(profileEntity