From 38c46d567ea517bbdea07b922c34cb2add6eccf3 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Tue, 30 Nov 2021 15:40:53 +0100 Subject: Fix comparison of data sets Fixes #16 --- .../modules/auth/eidas/v2/dao/SimpleEidasData.java | 23 ++++++---------------- .../auth/eidas/v2/tasks/InitialSearchTask.java | 2 +- .../ReceiveAustrianResidenceGuiResponseTask.java | 3 --- 3 files changed, 7 insertions(+), 21 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java index 35f353f4..5ad92507 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java @@ -23,12 +23,10 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao; -import org.apache.commons.lang3.builder.EqualsBuilder; - -import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException; import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType; import lombok.Builder; import lombok.Data; +import org.apache.commons.lang3.builder.EqualsBuilder; @Data @Builder @@ -60,27 +58,18 @@ public class SimpleEidasData { private final String taxNumber; /** - * Compares the register result with the eidas data. + * Compares the register result with the EIDAS data (given name, family name, date of birth, personal identifier). * * @param result The register data to use for comparison - * @return true or false depending of the data matches - * @throws WorkflowException if multiple results have been found + * @return whether the data (given name, family name, date of birth, personal identifier) match */ - public boolean equalsRegisterData(RegisterResult result) throws WorkflowException { - /*TODO: maybe this is check is not valid, because only the minimum data-set (personalIdentifer, givenName, - * familyName, dateOfBirth) has to be always available. Any other attributes are optional. - * This check will always evaluate to false if register has more information as current eIDAS process!!! - */ - + public boolean equalsRegisterData(RegisterResult result) { return new EqualsBuilder() .append(result.getGivenName(), givenName) .append(result.getFamilyName(), familyName) .append(result.getDateOfBirth(), dateOfBirth) - .append(result.getPlaceOfBirth(), placeOfBirth) - .append(result.getBirthName(), birthName) - .append(result.getTaxNumber(), taxNumber) - .isEquals() && result.getPseudonym().stream() - .anyMatch(el -> el.equals(pseudonym)); + .isEquals() + && result.getPseudonym().stream().anyMatch(el -> el.equals(pseudonym)); } /** diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java index 6b0f336e..f295d66b 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java @@ -181,7 +181,7 @@ public class InitialSearchTask extends AbstractAuthServletTask { } private RegisterResult step3CheckRegisterUpdateNecessary(RegisterResult searchResult, - SimpleEidasData eidasData) throws WorkflowException { + SimpleEidasData eidasData) { log.trace("Starting step3CheckRegisterUpdateNecessary"); if (!eidasData.equalsRegisterData(searchResult)) { log.info("Skipping update-register-information step, because it's not supported yet"); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java index 53485b03..b9a55df4 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java @@ -158,9 +158,6 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractAuthServlet RegisterStatusResults residencyResult, SimpleEidasData eidasData) throws TaskExecutionException, EaafStorageException { try { - /*TODO: check 'equalsRegisterData' because this method maybe this method evaluate to an invalid result. - * See TODO in methods body - */ if (eidasData.equalsRegisterData(residencyResult.getResult())) { // update register information registerSearchService.step7aKittProcess(residencyResult, eidasData); -- cgit v1.2.3