From 4bd5e89de5c8256aa5ce35bf29053ded0c649801 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Wed, 16 Dec 2020 10:47:09 +0100 Subject: added country specific search classes --- .../v2/dao/CountrySpecificDetailSearchResult.java | 2 +- .../handler/DeSpecificDetailSearchProcessor.java | 32 ++++++++++++++++++++++ .../ICountrySpecificDetailSearchProcessor.java | 11 +------- .../handler/ItSpecificDetailSearchProcessor.java | 29 ++++++++++++++++++++ .../auth/eidas/v2/tasks/InitialSearchTask.java | 15 +++++----- .../src/main/resources/eidas_v2_auth.beans.xml | 8 ++++++ 6 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/CountrySpecificDetailSearchResult.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/CountrySpecificDetailSearchResult.java index b74172f9..6e1f8653 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/CountrySpecificDetailSearchResult.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/CountrySpecificDetailSearchResult.java @@ -6,7 +6,7 @@ import java.util.ArrayList; public class CountrySpecificDetailSearchResult { - //TODO is the result the same as the one form the initial search? + //TODO is the result the same as the one from the initial search? ArrayList resultsZmr = new ArrayList<>(); ArrayList resultsErnb = new ArrayList<>(); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java new file mode 100644 index 00000000..727aa718 --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java @@ -0,0 +1,32 @@ +package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler; + +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.CountrySpecificDetailSearchResult; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; + +public class DeSpecificDetailSearchProcessor implements ICountrySpecificDetailSearchProcessor { + + @Override + public String getName() { + return this.getClass().getName(); + } + + @Override + public boolean canHandle(String countryCode, SimpleEidasData eidData) { + if (!countryCode.equalsIgnoreCase("de")) { + return false; + } + if (eidData.getBirthName() == null || eidData.getBirthName().isEmpty()) { + return false; + } + if (eidData.getPlaceOfBirth() == null || eidData.getPlaceOfBirth().isEmpty()) { + return false; + } + return true; + } + + @Override + public CountrySpecificDetailSearchResult search(SimpleEidasData eidData) { + //TODO + return new CountrySpecificDetailSearchResult(); + } +} diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java index 13d9117d..8ddd79bb 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java @@ -35,16 +35,6 @@ public interface ICountrySpecificDetailSearchProcessor { */ String getName(); - /** - * Get the priority of this eID Post-Processor
- * If more than one Post-Processor implementations can handle the eID data, the - * post-processor with the highest priority are selected. The Default-Processor - * has priority '0' - * - * @return Priority of this handler - */ - int getPriority(); - /** * Check if this postProcessor is sensitive for a specific country. * @@ -55,4 +45,5 @@ public interface ICountrySpecificDetailSearchProcessor { boolean canHandle(String countryCode, SimpleEidasData eidData); CountrySpecificDetailSearchResult search(SimpleEidasData eidData); + } diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java new file mode 100644 index 00000000..bb0a5262 --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java @@ -0,0 +1,29 @@ +package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler; + +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.CountrySpecificDetailSearchResult; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; + +public class ItSpecificDetailSearchProcessor implements ICountrySpecificDetailSearchProcessor { + + @Override + public String getName() { + return this.getClass().getName(); + } + + @Override + public boolean canHandle(String countryCode, SimpleEidasData eidData) { + if (!countryCode.equalsIgnoreCase("it")) { + return false; + } + if (eidData.getTaxNumber() == null || eidData.getTaxNumber().isEmpty()) { + return false; + } + return true; + } + + @Override + public CountrySpecificDetailSearchResult search(SimpleEidasData eidData) { + //TODO + return new CountrySpecificDetailSearchResult(); + } +} 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 d8c14b8e..2a5b9a23 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 @@ -24,7 +24,6 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -52,7 +51,6 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ICountrySpecificDetailSearchProcessor; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils; import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient; @@ -67,6 +65,7 @@ import eu.eidas.auth.commons.light.ILightResponse; import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress; import lombok.extern.slf4j.Slf4j; + /** * Task that searches ErnB and ZMR before adding person to SZR. * @@ -111,12 +110,12 @@ public class InitialSearchTask extends AbstractAuthServletTask { } - log.trace("Sorting country specific detail search services on priority ... "); - Collections.sort(handlers, (thisAuthModule, otherAuthModule) -> { - final int thisOrder = thisAuthModule.getPriority(); - final int otherOrder = otherAuthModule.getPriority(); - return thisOrder < otherOrder ? 1 : thisOrder == otherOrder ? 0 : -1; - }); + // log.trace("Sorting country specific detail search services on priority ... "); + // Collections.sort(handlers, (thisAuthModule, otherAuthModule) -> { + // final int thisOrder = thisAuthModule.getPriority(); + // final int otherOrder = otherAuthModule.getPriority(); + // return thisOrder < otherOrder ? 1 : thisOrder == otherOrder ? 0 : -1; + // }); log.info("# " + handlers.size() + " country specific detail search services are registrated"); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml index 0f6277c0..ca6eba20 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml @@ -80,6 +80,14 @@ + + + + + +