diff options
author | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2020-12-16 11:22:00 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-01-15 14:18:45 +0100 |
commit | 69c5f2715fa545554867d9022952b05dc003e186 (patch) | |
tree | c34aa7d287ce95e5190d7abe7ca29cce171d066c | |
parent | 4bd5e89de5c8256aa5ce35bf29053ded0c649801 (diff) | |
download | National_eIDAS_Gateway-69c5f2715fa545554867d9022952b05dc003e186.tar.gz National_eIDAS_Gateway-69c5f2715fa545554867d9022952b05dc003e186.tar.bz2 National_eIDAS_Gateway-69c5f2715fa545554867d9022952b05dc003e186.zip |
removed CountrySpecificDetailSearchResult, implemented countryspecific search classes
9 files changed, 88 insertions, 45 deletions
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 deleted file mode 100644 index 6e1f8653..00000000 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/CountrySpecificDetailSearchResult.java +++ /dev/null @@ -1,32 +0,0 @@ -package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao; - -import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException; - -import java.util.ArrayList; - -public class CountrySpecificDetailSearchResult { - - //TODO is the result the same as the one from the initial search? - ArrayList<RegisterResult> resultsZmr = new ArrayList<>(); - ArrayList<RegisterResult> resultsErnb = new ArrayList<>(); - - public int getResultCount() { - return resultsZmr.size() + resultsErnb.size(); - } - - /** - * Verfies that there is only one match and retunrs the bpk. - * @return bpk bpk of the match - * @throws WorkflowException if multiple results have been found - */ - public String getBpk() throws WorkflowException { - if (getResultCount() != 1) { - throw new WorkflowException("getResultCount() != 1"); - } - if (resultsZmr.size() == 1) { - return resultsZmr.get(0).getBpk(); - } else { - return resultsErnb.get(0).getBpk(); - } - } -} diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java index 8b2379bf..7e926c8e 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/DummyErnbClient.java @@ -26,6 +26,17 @@ public class DummyErnbClient implements IErnbClient { return resultEmpty();//TODO will I only receive matches where all three values match perfectly? } + @Override + public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth, + String birthPlace, String birthName) { + return resultEmpty();//TODO + } + + @Override + public ArrayList<RegisterResult> searchItSpecific(String txNumber) { + return resultEmpty();//TODO + } + private ArrayList<RegisterResult> resultEmpty() { return new ArrayList<RegisterResult>();//Nobody found } diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java index 4873b939..f8a41cfe 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/ernb/IErnbClient.java @@ -9,4 +9,10 @@ public interface IErnbClient { ArrayList<RegisterResult> searchWithPersonIdentifer(String personIdentifer); ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth); + + ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth, + String birthPlace, String birthName); + + ArrayList<RegisterResult> searchItSpecific(String txNumber); + } 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 index 727aa718..9fa13fe8 100644 --- 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 @@ -1,10 +1,22 @@ 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.MergedRegisterSearchResult; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.ArrayList; public class DeSpecificDetailSearchProcessor implements ICountrySpecificDetailSearchProcessor { + @Autowired + private IErnbClient ernbClient; + + @Autowired + private IZmrClient zmrClient; + @Override public String getName() { return this.getClass().getName(); @@ -25,8 +37,18 @@ public class DeSpecificDetailSearchProcessor implements ICountrySpecificDetailSe } @Override - public CountrySpecificDetailSearchResult search(SimpleEidasData eidData) { - //TODO - return new CountrySpecificDetailSearchResult(); + public MergedRegisterSearchResult search(SimpleEidasData eidData) { + MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(); + + ArrayList<RegisterResult> resultsZmr = + zmrClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(), + eidData.getPlaceOfBirth(), eidData.getBirthName()); + searchResult.setResultsZmr(resultsZmr); + + ArrayList<RegisterResult> resultsErnb = + ernbClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(), + eidData.getPlaceOfBirth(), eidData.getBirthName()); + searchResult.setResultsErnb(resultsErnb); + return searchResult; } } 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 8ddd79bb..887aef4a 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 @@ -23,7 +23,7 @@ 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.MergedRegisterSearchResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; public interface ICountrySpecificDetailSearchProcessor { @@ -44,6 +44,6 @@ public interface ICountrySpecificDetailSearchProcessor { */ boolean canHandle(String countryCode, SimpleEidasData eidData); - CountrySpecificDetailSearchResult search(SimpleEidasData eidData); + MergedRegisterSearchResult 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 index bb0a5262..e3b9e702 100644 --- 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 @@ -1,10 +1,22 @@ 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.MergedRegisterSearchResult; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.ArrayList; public class ItSpecificDetailSearchProcessor implements ICountrySpecificDetailSearchProcessor { + @Autowired + private IErnbClient ernbClient; + + @Autowired + private IZmrClient zmrClient; + @Override public String getName() { return this.getClass().getName(); @@ -22,8 +34,16 @@ public class ItSpecificDetailSearchProcessor implements ICountrySpecificDetailSe } @Override - public CountrySpecificDetailSearchResult search(SimpleEidasData eidData) { - //TODO - return new CountrySpecificDetailSearchResult(); + public MergedRegisterSearchResult search(SimpleEidasData eidData) { + MergedRegisterSearchResult searchResult = new MergedRegisterSearchResult(); + + ArrayList<RegisterResult> resultsZmr = + zmrClient.searchItSpecific(eidData.getTaxNumber()); + searchResult.setResultsZmr(resultsZmr); + + ArrayList<RegisterResult> resultsErnb = + ernbClient.searchItSpecific(eidData.getTaxNumber()); + searchResult.setResultsErnb(resultsErnb); + return searchResult; } } 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 2a5b9a23..9df24e9f 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 @@ -43,7 +43,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.CountrySpecificDetailSearchResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; @@ -249,7 +248,7 @@ public class InitialSearchTask extends AbstractAuthServletTask { MergedRegisterSearchResult initialSearchResult, SimpleEidasData eidData) throws TaskExecutionException { //6 country specific search - CountrySpecificDetailSearchResult countrySpecificDetailSearchResult = + MergedRegisterSearchResult countrySpecificDetailSearchResult = countrySpecificDetailSearchProcessor.search(eidData); switch (countrySpecificDetailSearchResult.getResultCount()) { @@ -264,7 +263,7 @@ public class InitialSearchTask extends AbstractAuthServletTask { } private String step7a(MergedRegisterSearchResult initialSearchResult, - CountrySpecificDetailSearchResult countrySpecificDetailSearchResult, + MergedRegisterSearchResult countrySpecificDetailSearchResult, SimpleEidasData eidData) throws TaskExecutionException { //TODO automerge log.debug("Automerge " + initialSearchResult + " with " + eidData + " " + countrySpecificDetailSearchResult); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java index 9a7cc9b3..343651f7 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/DummyZmrClient.java @@ -26,6 +26,17 @@ public class DummyZmrClient implements IZmrClient { return resultEmpty();//TODO will I only receive matches where all three values match perfectly? } + @Override + public ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth, + String birthPlace, String birthName) { + return resultEmpty();//TODO + } + + @Override + public ArrayList<RegisterResult> searchItSpecific(String txNumber) { + return resultEmpty();//TODO + } + private ArrayList<RegisterResult> resultEmpty() { return new ArrayList<RegisterResult>();//Nobody found } diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java index 1f7e4949..018122ea 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/zmr/IZmrClient.java @@ -9,4 +9,10 @@ public interface IZmrClient { ArrayList<RegisterResult> searchWithPersonIdentifer(String personIdentifer); ArrayList<RegisterResult> searchWithMds(String givenName, String familyName, String dateOfBirth); + + ArrayList<RegisterResult> searchDeSpecific(String givenName, String familyName, String dateOfBirth, + String birthPlace, String birthName); + + ArrayList<RegisterResult> searchItSpecific(String txNumber); + } |