processedMsg = validateAssertion((PvpSProfileResponse) inboundMessage);
if (processedMsg.getSecond()) {
// forward to next matching step in case of ID Autria authentication was stopped by user
- executionContext.put(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true);
+ executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_23);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
return;
}
@@ -171,8 +177,9 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet
// check if MDS from ID Austria authentication matchs to eIDAS authentication
if (!simpleMobileSignatureData.equalsSimpleEidasData(eidasData)) {
- executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_24);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
return;
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml
index 05c42fce..6ca21550 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml
@@ -56,7 +56,7 @@
-
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties
index f1bf2128..8d65d63f 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties
@@ -26,6 +26,8 @@ module.eidasauth.matching.12=Matching failed, because ERnP response contains his
module.eidasauth.matching.20=Matching be using residence information was canceled. Use another method for matching or create a new Austrian identity.
module.eidasauth.matching.21=Matching be using residence information failed by missing input information. Use another method for matching or create a new Austrian identity.
module.eidasauth.matching.22=Can not find an unique match by using residence information. Provide more or other data, use another method for matching, or create a new Austrian identity.
+module.eidasauth.matching.23=Matching be using Austrian Identity was canceled. Use another method for matching or create a new Austrian identity.
+module.eidasauth.matching.24=Matching be using Austrian Identity not possible. Use another method for matching or create a new Austrian identity.
module.eidasauth.matching.99=Matching failed, because of an unexpected processing error. Reason: {0}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java
index d5400695..b9133392 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java
@@ -282,7 +282,10 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
task.execute(pendingReq, executionContext);
- assertEquals("Transition To S16", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK));
+ assertEquals("Transition To S16", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("failed reason", "module.eidasauth.matching.23", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
+ assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
}
@@ -326,7 +329,10 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest {
task.execute(pendingReq, executionContext);
assertEquals("Next task", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
- assertEquals("advancedMatchingError flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("failed reason", "module.eidasauth.matching.24", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
+ assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
+
}
//TODO: implement new test that this test makes no sense any more
--
cgit v1.2.3
From 6936c9a9350ad5d83f6c84d649df63d5de1c188a Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Tue, 8 Feb 2022 16:37:50 +0100
Subject: chore(matching): update matching by 'alternative eIDAS Login' to
forward user to 'otherLoginMethod' GUI in case of an error and show specific
error message
---
.../specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java | 6 ++++++
.../src/main/resources/messages/eidas_connector_message.properties | 1 +
.../eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java | 3 +++
3 files changed, 10 insertions(+)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java
index f021fae9..96aa9c51 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java
@@ -23,6 +23,8 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks;
+import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED;
+import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK;
import java.util.Map;
@@ -78,6 +80,8 @@ import lombok.extern.slf4j.Slf4j;
@SuppressWarnings("PMD.TooManyStaticImports")
public class AlternativeSearchTask extends AbstractAuthServletTask {
+ private static final String MSG_PROP_25 = "module.eidasauth.matching.25";
+
private final RegisterSearchService registerSearchService;
private final ICcSpecificEidProcessingService eidPostProcessor;
@@ -200,6 +204,8 @@ public class AlternativeSearchTask extends AbstractAuthServletTask {
log.trace("'step12CountrySpecificSearch' ends with no result. Forward to GUI based matching step ... ");
log.debug("Forward to GUI based matching steps ... ");
executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_25);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
} else if (ccAltSearchResult.getResultCount() == 1) {
log.debug("'step12CountrySpecificSearch' find single result. Starting KITT operation ... ");
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties
index 8d65d63f..3942f30a 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties
@@ -28,6 +28,7 @@ module.eidasauth.matching.21=Matching be using residence information failed by m
module.eidasauth.matching.22=Can not find an unique match by using residence information. Provide more or other data, use another method for matching, or create a new Austrian identity.
module.eidasauth.matching.23=Matching be using Austrian Identity was canceled. Use another method for matching or create a new Austrian identity.
module.eidasauth.matching.24=Matching be using Austrian Identity not possible. Use another method for matching or create a new Austrian identity.
+module.eidasauth.matching.25=Matching be using alternative eIDAS authentication not possible. Provide more or other data, use another method for matching, or create a new Austrian identity.
module.eidasauth.matching.99=Matching failed, because of an unexpected processing error. Reason: {0}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
index 79b2532b..66807ee0 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
@@ -815,6 +815,9 @@ public class AlternativeSearchTaskWithRegisterTest {
assertNull("final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
assertEquals("wrong executionContextFlag 'alternative eIDAS result'", true,
executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("failed reason", "module.eidasauth.matching.25", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
+
// validate request
--
cgit v1.2.3
From 71d94fdd4435187c13321322893cd9b1bf273402 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Tue, 8 Feb 2022 17:16:42 +0100
Subject: chore(matching): update 'other-login-method' GUI steps to use it as
common starting-point for any other alternative matching method
---
basicConfig/properties/messages.properties | 17 ++++-
basicConfig/properties/messages_de.properties | 17 ++++-
basicConfig/templates/other_login_method.html | 36 ++++++++--
.../specific/modules/auth/eidas/v2/Constants.java | 4 +-
.../v2/tasks/GenerateOtherLoginMethodGuiTask.java | 7 ++
.../ReceiveOtherLoginMethodGuiResponseTask.java | 17 +++--
.../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 76 +++++++++++++++-------
7 files changed, 134 insertions(+), 40 deletions(-)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
diff --git a/basicConfig/properties/messages.properties b/basicConfig/properties/messages.properties
index 6674d0bd..fcb85bee 100644
--- a/basicConfig/properties/messages.properties
+++ b/basicConfig/properties/messages.properties
@@ -113,11 +113,22 @@ gui.countryselection.mode.dev=Development
##Other Login Methods page
gui.otherlogin.title=eIDAS-Login Other Login Methods
gui.otherlogin.header.selection=Select an alternative login method
-gui.otherlogin.hs=Mobile Signature ("Handy-Signatur")
-gui.otherlogin.eidas=Alternative eIDAS ID
-gui.otherlogin.none=No alternative login methods
+gui.otherlogin.button.hs=ID Austria
+gui.otherlogin.button.eidas=Alternative eIDAS ID
+gui.otherlogin.button.none=No alternative login methods
+gui.otherlogin.button.inserternp=Use my eIDAS data to create a new Austrian identity
gui.otherlogin.cancel=Cancel
+gui.otherlogin.inserternp.infotext=You can create a new Austrian Identity by using your identity information provided by eIDAS. During these, you get a new Austrian identifier.
+
+module.eidasauth.matching.20=Matching be using residence information was canceled. Use another method for matching or create a new Austrian identity.
+module.eidasauth.matching.21=Matching be using residence information failed by missing input information. Use another method for matching or create a new Austrian identity.
+module.eidasauth.matching.22=Can not find an unique match by using residence information. Provide more or other data, use another method for matching, or create a new Austrian identity.
+module.eidasauth.matching.23=Matching be using ID Austria was canceled. Use another method for matching or create a new Austrian identity.
+module.eidasauth.matching.24=Matching be using ID Austria not possible. Use another method for matching or create a new Austrian identity.
+module.eidasauth.matching.25=Matching be using alternative eIDAS authentication not possible. Provide more or other data, use another method for matching, or create a new Austrian identity.
+module.eidasauth.matching.29=Matching be using other information failed. Provide more or other data, use another method for matching, or create a new Austrian identity.
+
##Austrian Residency page
gui.residency.title=Austrian Residency
diff --git a/basicConfig/properties/messages_de.properties b/basicConfig/properties/messages_de.properties
index 9c496903..613bead6 100644
--- a/basicConfig/properties/messages_de.properties
+++ b/basicConfig/properties/messages_de.properties
@@ -112,11 +112,22 @@ gui.countryselection.mode.dev=Development
##Other Login Methods page
gui.otherlogin.title=eIDAS-Login Alternative Anmeldemethoden
gui.otherlogin.header.selection=Wählen Sie eine alternative Anmeldemethode
-gui.otherlogin.hs=Handy-Signatur
-gui.otherlogin.eidas=Alternativer eIDAS Login
-gui.otherlogin.none=Keine
+gui.otherlogin.button.hs=Handy-Signatur
+gui.otherlogin.button.eidas=Alternativer eIDAS Login
+gui.otherlogin.button.none=Keine
+gui.otherlogin.button.inserternp=Eine neue österreichische Identity auf Basis meiner eIDAS Daten erzeugen
gui.otherlogin.cancel=Abbrechen
+gui.otherlogin.inserternp.infotext=Falls Sie sich noch nie mit eIDAS in Österreich angemeldet haben und Sie auch noch keinen anderen Kontakt zur österreichischen Verwaltung hatten können Sie eine neue österreichischen Identifikatior erzeugen.
+
+module.eidasauth.matching.20=Matching auf Basis eine Wohnanschrift in Österreich wurde abgebrochen. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator.
+module.eidasauth.matching.21=Das Matching auf Basis eine Wohnanschrift in Österreich schlug fehl. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator.
+module.eidasauth.matching.22=Das Matching auf Basis eine Wohnanschrift in Österreich schlug fehl. Stellen Sie weitere Informationen bereit, nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator.
+module.eidasauth.matching.23=Matching auf Basis eines ID Autria wurde abgebrochen. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator.
+module.eidasauth.matching.24=Matching auf Basis eines ID Autria schlug fehl. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator.
+module.eidasauth.matching.25=Matching auf Basis einer alternativen eIDAS Anmeldung schlug fehl. Stellen Sie weitere Informationen bereit, nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator.
+
+
##Austrian Residency page
gui.residency.title=Österreichischer Wohnsitz
gui.residency.header.selection=Suche nach Österreichischem Wohnsitz
diff --git a/basicConfig/templates/other_login_method.html b/basicConfig/templates/other_login_method.html
index 8f846f84..4fc061c0 100644
--- a/basicConfig/templates/other_login_method.html
+++ b/basicConfig/templates/other_login_method.html
@@ -49,29 +49,57 @@
Betrieben durch das Bundesministerium für Inneres
+
+
Detailed
+
Generell
+
+
+
+
+
+
Select an alternative login method
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
index 40bcd27a..e642c5ec 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
@@ -314,12 +314,14 @@ public class Constants {
// UI options
public static final String HTML_FORM_ADVANCED_MATCHING_FAILED = "advancedMatchingFailed";
+ public static final String HTML_FORM_ADVANCED_MATCHING_FAILED_REASON =
+ HTML_FORM_ADVANCED_MATCHING_FAILED + "Reason";
// ProcessEngine context
public static final String CONTEXT_FLAG_ADVANCED_MATCHING_FAILED = HTML_FORM_ADVANCED_MATCHING_FAILED;
public static final String CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON =
- HTML_FORM_ADVANCED_MATCHING_FAILED + "Reason";
+ HTML_FORM_ADVANCED_MATCHING_FAILED_REASON;
/**
* {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask}.
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java
index 7107709f..d29519be 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java
@@ -79,6 +79,13 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask {
config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS,
Constants.HTML_FORM_ADVANCED_MATCHING_FAILED, String.valueOf(true));
+ //set detailed error-code
+ if (executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON) != null) {
+ config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS,
+ Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON,
+ executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON).toString());
+ }
+
}
guiBuilder.build(request, response, config, "Other login methods selection form");
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
index f4419c1c..c9f043b5 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
@@ -23,17 +23,19 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks;
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.springframework.stereotype.Component;
+
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.impl.idp.controller.tasks.AbstractLocaleAuthServletTask;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Enumeration;
/**
* Handles user's selection from {@link GenerateOtherLoginMethodGuiTask}.
@@ -65,12 +67,13 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe
SelectedLoginMethod selection = SelectedLoginMethod.valueOf(extractUserSelection(request));
executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection);
executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED);
+ executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON);
transitionToNextTask(executionContext, selection);
} catch (final Exception e) {
log.error("Parsing selected login method FAILED.", e);
executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
- executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
+ executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
}
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java
index f17f69c3..ff994061 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java
@@ -1,15 +1,13 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateOtherLoginMethodGuiTask;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.json.JsonMapper;
-import lombok.SneakyThrows;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import java.text.MessageFormat;
+import java.util.Locale;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -26,12 +24,17 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import java.io.UnsupportedEncodingException;
-import java.text.MessageFormat;
-import java.util.Locale;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateOtherLoginMethodGuiTask;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
+import lombok.SneakyThrows;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
@@ -82,8 +85,9 @@ public class GenerateOtherLoginMethodGuiTaskTest {
@Test
@SneakyThrows
public void jsonResponse() throws TaskExecutionException, UnsupportedEncodingException {
-
+ String reason = RandomStringUtils.randomAlphabetic(5);
executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
+ executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, reason);
httpReq.addHeader("Accept", "application/json");
task.execute(pendingReq, executionContext);
@@ -98,20 +102,44 @@ public class GenerateOtherLoginMethodGuiTaskTest {
assertNotNull("response body is null", json);
assertNotNull("advancedMatchFailed", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED));
assertTrue("advancedMatchFailed", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED).asBoolean());
-
+ assertNotNull("advancedMatchingFailedReason", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON));
+ assertEquals("advancedMatchingFailedReason", reason,
+ json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON).asText());
+
}
@Test
public void advancedMatchingFailedMsg() throws TaskExecutionException, UnsupportedEncodingException {
-
executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
task.execute(pendingReq, executionContext);
+
+ String html = doBasicValidation();
+ Assert.assertTrue("Missing eIDAS infos",
+ html.contains(MessageFormat.format(TEST_PATTER_REQ_PARAM, SelectedLoginMethod.ADD_ME_AS_NEW)));
+ Assert.assertTrue("missing errorfield",
+ html.contains(""));
+
+ return html;
}
}
--
cgit v1.2.3
From 0fb02a267d231ce130f7ea419cade9a0cc79bb6e Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Tue, 8 Feb 2022 17:35:24 +0100
Subject: fix(matching): update wrong error-reason and remove an unused method
parameter
---
.../v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java | 13 ++++++-------
.../tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java | 14 ++++++++++++++
2 files changed, 20 insertions(+), 7 deletions(-)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
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 08d2bfa1..89a3f350 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
@@ -117,11 +117,11 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS
AdresssucheOutput input = parseHtmlInput(request);
if (validateHtmlInput(input)) {
// HTML form should ensure that mandatory fields are set => this should never happen
- log.warn("HTML form contains no residence information. Switch back to 'other matching' selection ... ");
+ log.warn("HTML form contains no residence information. Switch back to 'other matching' selection ... ");
executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
-
- executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_20);
- executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
+
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_21);
+ executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true);
return;
}
@@ -145,7 +145,7 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS
} else {
log.debug("Find single match by using residence information. Starting data validation ... ");
- compareSearchResultWithInitialData(executionContext, residencyResult, eidasData);
+ compareSearchResultWithInitialData(residencyResult, eidasData);
}
@@ -167,8 +167,7 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS
&& StringUtils.isEmpty(input.getVillage());
}
- private void compareSearchResultWithInitialData(ExecutionContext executionContext,
- RegisterStatusResults residencyResult, SimpleEidasData eidasData)
+ private void compareSearchResultWithInitialData(RegisterStatusResults residencyResult, SimpleEidasData eidasData)
throws TaskExecutionException, EaafStorageException {
try {
if (!eidasData.equalsRegisterData(residencyResult.getResult())) {
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
index 15edce07..7758e021 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java
@@ -107,6 +107,20 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest {
}
+ @Test
+ public void noInputData() throws Exception {
+ RegisterStatusResults registerSearchResult = buildEmptyResult();
+ MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, registerSearchResult);
+
+ task.execute(pendingReq, executionContext);
+
+ assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED));
+ assertEquals("failed reason", "module.eidasauth.matching.21", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON));
+ assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq));
+
+ }
+
@Test
public void noRegisterResult() throws Exception {
AdresssucheOutput userInput = setupUserInput();
--
cgit v1.2.3
From e4ccd3df84e7ea509e66f2f832719529fe408839 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Wed, 9 Feb 2022 08:34:26 +0100
Subject: feature(zmr): add MDS attributes as 'eIdAS-Documents' too
ZMR does not allow MDS update on regular places. Therefore, we add it as 'eIDAS-Documents' for later usage.
---
.../specific/modules/auth/eidas/v2/Constants.java | 8 ++-
.../auth/eidas/v2/clients/zmr/ZmrSoapClient.java | 12 ++++
.../auth/eidas/v2/test/clients/ZmrClientTest.java | 13 ++--
.../AlternativeSearchTaskWithRegisterTest.java | 24 +++++++-
.../tasks/InitialSearchTaskWithRegistersTest.java | 8 +--
.../seq_1-8_search_with_personalId_only_resp.xml | 71 +++++++++++++++++++++-
.../zmr/seq_3-8_kitt_get_latest_version_resp.xml | 71 +++++++++++++++++++++-
7 files changed, 193 insertions(+), 14 deletions(-)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
index e642c5ec..272d79c4 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
@@ -268,7 +268,13 @@ public class Constants {
public static final String eIDAS_ATTRURN_PREFIX_NATURAL = eIDAS_ATTRURN_PREFIX + "naturalperson/";
public static final String eIDAS_ATTRURN_PERSONALIDENTIFIER =
- eIDAS_ATTRURN_PREFIX_NATURAL + eIDAS_ATTR_PERSONALIDENTIFIER;
+ eIDAS_ATTRURN_PREFIX_NATURAL + eIDAS_ATTR_PERSONALIDENTIFIER;
+ public static final String eIDAS_ATTRURN_CURRENTGIVENNAME =
+ eIDAS_ATTRURN_PREFIX_NATURAL + "CurrentGivenName";
+ public static final String eIDAS_ATTRURN_CURRENTFAMILYNAME =
+ eIDAS_ATTRURN_PREFIX_NATURAL + "CurrentFamilyName";
+ public static final String eIDAS_ATTRURN_DATEOFBIRTH =
+ eIDAS_ATTRURN_PREFIX_NATURAL + eIDAS_ATTR_DATEOFBIRTH;
public static final String eIDAS_ATTRURN_PLACEOFBIRTH =
eIDAS_ATTRURN_PREFIX_NATURAL + eIDAS_ATTR_PLACEOFBIRTH;
public static final String eIDAS_ATTRURN_BIRTHNAME =
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java
index f24c75eb..8dbd0632 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java
@@ -264,6 +264,10 @@ public class ZmrSoapClient extends AbstractSoapClient implements IZmrClient {
Collection extends EidasIdentitaetAnlageType> eidasDocumentToAdd =
selectEidasDocumentsToAdd(zmrPersonToKitt, eidData);
+ /*TODO: Is there a requirement to change 'eIDAS-Documents'?
+ * We add MDS information as 'eIDAS-Documents' too. Maybe, we should update that in a later version.
+ */
+
if (eidasDocumentToAdd.isEmpty()) {
log.info("Find no eIDAS document for update during: {}. Nothing todo on ZMR side",
PROCESS_KITT_GENERAL);
@@ -766,6 +770,14 @@ public class ZmrSoapClient extends AbstractSoapClient implements IZmrClient {
Constants.eIDAS_ATTRURN_PLACEOFBIRTH, eidData.getPlaceOfBirth(), false);
addEidasDocumentIfNotAvailable(result, zmrPersonToKitt, eidData.getCitizenCountryCode(),
Constants.eIDAS_ATTRURN_BIRTHNAME, eidData.getBirthName(), false);
+
+ // add MDS attributes as 'eIDAS-Documents' too, because ZMR does not allow a MDS update on regular places.
+ addEidasDocumentIfNotAvailable(result, zmrPersonToKitt, eidData.getCitizenCountryCode(),
+ Constants.eIDAS_ATTRURN_CURRENTGIVENNAME, eidData.getGivenName(), false);
+ addEidasDocumentIfNotAvailable(result, zmrPersonToKitt, eidData.getCitizenCountryCode(),
+ Constants.eIDAS_ATTRURN_CURRENTFAMILYNAME, eidData.getFamilyName(), false);
+ addEidasDocumentIfNotAvailable(result, zmrPersonToKitt, eidData.getCitizenCountryCode(),
+ Constants.eIDAS_ATTRURN_DATEOFBIRTH, eidData.getDateOfBirth(), false);
return result;
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java
index 290eefe4..2ff9f0cb 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java
@@ -940,13 +940,19 @@ public class ZmrClientTest {
assertEquals("2 req. tech. Ref. date", "2020-02-05T13:07:06.311",
secondpSuche.getPersonReferenz().getTechnisch().getLetzteAenderung().toString());
- assertEquals("eidas Docs. size", 3, secondpSuche.getEidasIdentitaetAnlage().size());
+ assertEquals("eidas Docs. size", 6, secondpSuche.getEidasIdentitaetAnlage().size());
checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
"http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth", cc, eidasData.getPlaceOfBirth());
checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
"http://eidas.europa.eu/attributes/naturalperson/BirthName", cc, eidasData.getBirthName());
checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
- "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasData.getPseudonym());
+ "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasData.getPseudonym());
+ checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
+ "http://eidas.europa.eu/attributes/naturalperson/CurrentGivenName", cc, eidasData.getGivenName());
+ checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
+ "http://eidas.europa.eu/attributes/naturalperson/CurrentFamilyName", cc, eidasData.getFamilyName());
+ checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
+ "http://eidas.europa.eu/attributes/naturalperson/DateOfBirth", cc, eidasData.getDateOfBirth());
// validate state
@@ -1110,8 +1116,7 @@ public class ZmrClientTest {
assertEquals("eidas Docs. size", 1, secondpSuche.getEidasIdentitaetAnlage().size());
checkEidasDocumentAdd(secondpSuche.getEidasIdentitaetAnlage(),
"http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasData.getPseudonym());
-
-
+
// validate state
assertNotNull("no ZMR response", resp);
assertEquals("wrong processId", "366200000000082", resp.getProcessId().toString());
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
index 66807ee0..3814c632 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java
@@ -71,6 +71,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils;
import at.gv.bmi.namespace.zmr_su.base._20040201.RequestType;
import at.gv.bmi.namespace.zmr_su.base._20040201.ResponseType;
import at.gv.bmi.namespace.zmr_su.base._20040201_.ServicePort;
+import at.gv.bmi.namespace.zmr_su.zmr._20040201.EidasIdentitaetAnlageType;
import at.gv.bmi.namespace.zmr_su.zmr._20040201.EidasSuchdatenType;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -509,7 +510,16 @@ public class AlternativeSearchTaskWithRegisterTest {
assertNotNull("PersonAender KITT req.", zmrReq.getAllValues().get(2).getPersonAendernRequest());
checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_UPDATE,
new BigInteger("367100000000079"), "jUnit123456");
-
+
+ assertEquals("wrong number of eIDAS Docs to Add", 4,
+ zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage().size());
+ checkEidasDocumentAdd(zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage(),
+ "http://eidas.europa.eu/attributes/naturalperson/DateOfBirth", "DE", "1994-12-31");
+ checkEidasDocumentAdd(zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage(),
+ "http://eidas.europa.eu/attributes/naturalperson/CurrentGivenName", "DE", "XXXKlaus - Maria");
+ checkEidasDocumentAdd(zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage(),
+ "http://eidas.europa.eu/attributes/naturalperson/CurrentFamilyName", "DE", "XXXvon Brandenburg");
+
assertNotNull("Personensuche KITT req.", zmrReq.getAllValues().get(3).getPersonSuchenRequest());
checkBasicRequestParameters(zmrReq.getAllValues().get(3), ZmrClientTest.PROCESS_TASK_SEARCH,
new BigInteger("367100000000079"), "jUnit123456");
@@ -1011,6 +1021,18 @@ public class AlternativeSearchTaskWithRegisterTest {
}
+
+ private void checkEidasDocumentAdd(List list, String type, String cc, String value) {
+ Optional eidasDoc = list.stream()
+ .filter(el -> type.equals(el.getEidasArt()))
+ .findFirst();
+
+ assertTrue("eidas doc: " + type, eidasDoc.isPresent());
+ assertEquals("eIDAS docType", type, eidasDoc.get().getEidasArt());
+ assertEquals("eIDAS docValue", value, eidasDoc.get().getEidasWert());
+ assertEquals("eIDAS docCC", cc, eidasDoc.get().getStaatscode2());
+ }
+
@NotNull
private ErnpRegisterResult emptyErnpRegisterResult() {
return new ErnpRegisterResult(Collections.emptyList());
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
index 7f27a17c..18d76264 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
@@ -283,12 +283,8 @@ public class InitialSearchTaskWithRegistersTest {
assertNotNull("Personenupdate req.", zmrReq.getAllValues().get(2).getPersonAendernRequest());
checkBasicRequestParameters(zmrReq.getAllValues().get(2), ZmrClientTest.PROCESS_TASK_UPDATE,
new BigInteger("367100000000079"), "jUnit123456");
- assertEquals("eIDAS attribute to add", 1,
- zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage().size());
- assertEquals("eIDAS attribute to add - Type", "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
- zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage().get(0).getEidasArt());
- assertEquals("eIDAS attribute to add - Value", placeOfBirth,
- zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage().get(0).getEidasWert());
+ assertEquals("eIDAS attribute to add", 4,
+ zmrReq.getAllValues().get(2).getPersonAendernRequest().getEidasIdentitaetAnlage().size());
assertNull("ZMR update MDS", zmrReq.getAllValues().get(2).getPersonAendernRequest().getPersonAenderung());
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_1-8_search_with_personalId_only_resp.xml b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_1-8_search_with_personalId_only_resp.xml
index 3fd477ee..f21c3698 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_1-8_search_with_personalId_only_resp.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_1-8_search_with_personalId_only_resp.xml
@@ -182,7 +182,76 @@
7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit
9999-12-31
9999-12-31
-
+
+
+
+
+ 1879000000000005
+ 2021-11-12T08:24:39.695
+
+ 2021-11-12T08:24:39.695
+ EIDAS_ANLEGEN
+ KITT for eIDAS Matching
+
+
+ 101179
+
+ eidtapp@bmi.gv.at
+
+
+ http://eidas.europa.eu/attributes/naturalperson/CurrentFamilyName
+ DE
+
+ XXXvon Brandenburg
+ 9999-12-31
+ 9999-12-31
+
+
+
+
+ 1879000000000005
+ 2021-11-12T08:24:39.695
+
+ 2021-11-12T08:24:39.695
+ EIDAS_ANLEGEN
+ KITT for eIDAS Matching
+
+
+ 101179
+
+ eidtapp@bmi.gv.at
+
+
+ http://eidas.europa.eu/attributes/naturalperson/CurrentGivenName
+ DE
+
+ XXXClaus - Maria
+ 9999-12-31
+ 9999-12-31
+
+
+
+
+ 1879000000000005
+ 2021-11-12T08:24:39.695
+
+ 2021-11-12T08:24:39.695
+ EIDAS_ANLEGEN
+ KITT for eIDAS Matching
+
+
+ 101179
+
+ eidtapp@bmi.gv.at
+
+
+ http://eidas.europa.eu/attributes/naturalperson/DateOfBirth
+ DE
+
+ 1994-12-31
+ 9999-12-31
+ 9999-12-31
+
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml
index 447d2b55..656164f2 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/zmr/seq_3-8_kitt_get_latest_version_resp.xml
@@ -146,7 +146,76 @@
7cEYasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit
9999-12-31
9999-12-31
-
+
+
+
+
+ 1879000000000005
+ 2021-11-12T08:24:39.695
+
+ 2021-11-12T08:24:39.695
+ EIDAS_ANLEGEN
+ KITT for eIDAS Matching
+
+
+ 101179
+
+ eidtapp@bmi.gv.at
+
+
+ http://eidas.europa.eu/attributes/naturalperson/CurrentFamilyName
+ DE
+
+ XXXvon Brandenburg
+ 9999-12-31
+ 9999-12-31
+
+
+
+
+ 1879000000000005
+ 2021-11-12T08:24:39.695
+
+ 2021-11-12T08:24:39.695
+ EIDAS_ANLEGEN
+ KITT for eIDAS Matching
+
+
+ 101179
+
+ eidtapp@bmi.gv.at
+
+
+ http://eidas.europa.eu/attributes/naturalperson/CurrentGivenName
+ DE
+
+ XXXClaus - Maria
+ 9999-12-31
+ 9999-12-31
+
+
+
+
+ 1879000000000005
+ 2021-11-12T08:24:39.695
+
+ 2021-11-12T08:24:39.695
+ EIDAS_ANLEGEN
+ KITT for eIDAS Matching
+
+
+ 101179
+
+ eidtapp@bmi.gv.at
+
+
+ http://eidas.europa.eu/attributes/naturalperson/DateOfBirth
+ DE
+
+ 1994-12-31
+ 9999-12-31
+ 9999-12-31
+
--
cgit v1.2.3
From 0020b5d6084501b6ee6b6b07fdc40ab47dc30dc7 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Thu, 3 Mar 2022 11:43:59 +0100
Subject: test(ernp): add all ERnP integration tests into test that operates in
real test ERnP
---
.../modules/auth/eidas/v2/dao/SimpleEidasData.java | 2 +-
.../test/clients/ErnpRestClientProductionTest.java | 389 ++++++++++++++++++++-
2 files changed, 382 insertions(+), 9 deletions(-)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
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 f9301505..094b2a9f 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
@@ -32,7 +32,7 @@ import lombok.Builder;
import lombok.Data;
@Data
-@Builder
+@Builder(toBuilder=true)
public class SimpleEidasData implements Serializable {
private static final long serialVersionUID = 2848914124372968418L;
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java
index 6ebe4c8a..66a426a1 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java
@@ -1,9 +1,14 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +22,8 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.IErnpClient
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.exception.EidasSAuthenticationException;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.DeSpecificDetailSearchProcessor;
+import at.gv.bmi.namespace.zmr_su.zmr._20040201.PersonSuchenRequest;
import lombok.SneakyThrows;
@IfProfileValue(name = "spring.profiles.active", value = "devEnvironment")
@@ -30,18 +37,22 @@ import lombok.SneakyThrows;
})
public class ErnpRestClientProductionTest {
+ //private static final String TEST_PREFIX = "XXX_";
+ private static final String TEST_PREFIX = "";
+
@Autowired IErnpClient client;
@Test
@SneakyThrows
public void searchWithPersonalIdentifierServerError() {
- final String personalIdentifierFirst = "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit";
+ String personalIdentifierFirst = "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit";
+ personalIdentifierFirst = "";
final String cc = "DE";
final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
.citizenCountryCode(cc)
.familyName("XXXvon Brandenburg")
.givenName("XXXClaus - Maria")
- .dateOfBirth("1994-12-31")
+ .dateOfBirth("1994-12-00")
.personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
.pseudonym(personalIdentifierFirst)
.build();
@@ -59,12 +70,39 @@ public class ErnpRestClientProductionTest {
@SneakyThrows
public void searchWithPersonalIdentifierSuccess() {
final String personalIdentifierFirst = "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit";
- final String cc = "DE";
+ final String cc = "CZ";
final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
.citizenCountryCode(cc)
- .familyName("XXXvon Brandenburg")
- .givenName("XXXClaus - Maria")
- .dateOfBirth("1994-12-31")
+ .familyName("DOPISNÍ")
+ .givenName("DANA")
+ .dateOfBirth("1996-01-01")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithPersonIdentifier(
+ eidasDataFirst.getPseudonym(), eidasDataFirst.getCitizenCountryCode());
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ checkErnpResult(resp.getPersonResult().get(0), eidasDataFirst, 1);
+ assertEquals("wrong bpk", "vypyCkyczK7i+cgPWlJasuJphIA=",
+ resp.getPersonResult().get(0).getBpk());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdentifierNoResult() {
+ final String personalIdentifierFirst = RandomStringUtils.randomAlphanumeric(10);
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("DOPISNÍ")
+ .givenName("DANA")
+ .dateOfBirth("1996-01-01")
.personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
.pseudonym(personalIdentifierFirst)
.build();
@@ -73,15 +111,350 @@ public class ErnpRestClientProductionTest {
ErnpRegisterResult resp = client.searchWithPersonIdentifier(
eidasDataFirst.getPseudonym(), eidasDataFirst.getCitizenCountryCode());
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsSuccess() {
+ final String personalIdentifierFirst = "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit";
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("DOPISNÍ")
+ .givenName("DANA")
+ .dateOfBirth("1996-01-01")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(),
+ eidasDataFirst.getDateOfBirth(), eidasDataFirst.getCitizenCountryCode());
+
// validate state
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ checkErnpResult(resp.getPersonResult().get(0), eidasDataFirst, 1);
+ assertEquals("wrong bpk", "vypyCkyczK7i+cgPWlJasuJphIA=",
+ resp.getPersonResult().get(0).getBpk());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsNoResult() {
+ final String personalIdentifierFirst = RandomStringUtils.randomAlphanumeric(10);
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName(RandomStringUtils.randomAlphanumeric(10))
+ .givenName(RandomStringUtils.randomAlphanumeric(10))
+ .dateOfBirth("1996-10-15")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(),
+ eidasDataFirst.getDateOfBirth(), eidasDataFirst.getCitizenCountryCode());
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void addTwiceSameMdsAndMdsSearch() {
+ // *** add new random first person ***
+ final String addFirstPersonPersonalIdentifier = RandomStringUtils.randomAlphanumeric(10);
+ final String cc = "XZ";
+ final SimpleEidasData addFirstPersonData = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .givenName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .dateOfBirth("1996-01-01")
+ .personalIdentifier(cc + "/AT/" + addFirstPersonPersonalIdentifier)
+ .pseudonym(addFirstPersonPersonalIdentifier)
+ .build();
+
+ // add entry
+ ErnpRegisterResult addFirstPersonResponse = client.add(addFirstPersonData);
+
+ // verify added entry
+ assertNotNull("no ERnP response", addFirstPersonResponse);
+ assertEquals("wrong resp size", 1, addFirstPersonResponse.getPersonResult().size());
+ checkErnpResult(addFirstPersonResponse.getPersonResult().get(0), addFirstPersonData, 1);
+
+
+ // *** add new random second person with same MDS ***
+ final String addSecondPersonPersonalIdentifier = RandomStringUtils.randomAlphanumeric(10);
+ final SimpleEidasData addSecondPersonData = addFirstPersonData.toBuilder()
+ .personalIdentifier(cc + "/AT/" + addSecondPersonPersonalIdentifier)
+ .pseudonym(addSecondPersonPersonalIdentifier)
+ .build();
+
+ // add entry
+ ErnpRegisterResult addSecondPersonResponse = client.add(addSecondPersonData);
+
+ // verify added entry
+ assertNotNull("no ERnP response", addSecondPersonResponse);
+ assertEquals("wrong resp size", 1, addSecondPersonResponse.getPersonResult().size());
+ checkErnpResult(addSecondPersonResponse.getPersonResult().get(0), addSecondPersonData, 1);
- RegisterResult persInfo = resp.getPersonResult().get(0);
- assertEquals("wrong familyname", "XXXSZR", persInfo.getFamilyName());
+ // search with MDS
+ ErnpRegisterResult resp = client.searchWithMds(addFirstPersonData.getGivenName(), addFirstPersonData.getFamilyName(),
+ addFirstPersonData.getDateOfBirth(), cc);
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 2, resp.getPersonResult().size());
+
}
+
+ @Test
+ @SneakyThrows
+ public void addSearchAndPersonalIdUpdate() {
+ // *** add new random entry ***
+
+ final String addPersonPersonalIdentifier = RandomStringUtils.randomAlphanumeric(10);
+ final String cc = "DE";
+ final SimpleEidasData addPersonData = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .givenName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .dateOfBirth("1996-01-01")
+ .personalIdentifier(cc + "/AT/" + addPersonPersonalIdentifier)
+ .pseudonym(addPersonPersonalIdentifier)
+ .birthName(RandomStringUtils.randomAlphabetic(8))
+ .placeOfBirth(RandomStringUtils.randomAlphabetic(8))
+ .build();
+
+ // add entry
+ ErnpRegisterResult addPersonResponse = client.add(addPersonData);
+
+ // verify added entry
+ assertNotNull("no ERnP response", addPersonResponse);
+ assertEquals("wrong resp size", 1, addPersonResponse.getPersonResult().size());
+ checkErnpResult(addPersonResponse.getPersonResult().get(0), addPersonData, 1);
+
+
+ // *** search entry by countrySpecifics ***
+ final String ccPersonPersonalIdentifier = RandomStringUtils.randomAlphanumeric(10);
+ SimpleEidasData ccSpecificData = addPersonData.toBuilder()
+ .personalIdentifier(cc + "/AT/" + ccPersonPersonalIdentifier)
+ .pseudonym(ccPersonPersonalIdentifier)
+ .build();
+ PersonSuchenRequest ccSearchReq =
+ new DeSpecificDetailSearchProcessor().generateSearchRequest(ccSpecificData);
+
+ // search CC specific
+ ErnpRegisterResult ccSearchResponse = client.searchCountrySpecific(ccSearchReq, cc);
+
+ // verify cc specific result
+ assertNotNull("no ERnP response", ccSearchResponse);
+ assertEquals("wrong resp size", 1, ccSearchResponse.getPersonResult().size());
+ RegisterResult ccSearchPersResult = ccSearchResponse.getPersonResult().get(0);
+ checkErnpResult(ccSearchResponse.getPersonResult().get(0), addPersonData, 1);
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(),
+ ccSearchPersResult.getBpk());
+ assertFalse("no PersonalId change detected", ccSpecificData.equalsRegisterData(ccSearchPersResult));
+
+
+ // *** update entry because PersonalId has changed ***
+ // update ERnP entry
+ ErnpRegisterResult updateResponse = client.update(ccSearchPersResult, ccSpecificData);
+ assertNotNull("no ERnP response", updateResponse);
+ assertEquals("wrong resp size", 1, updateResponse.getPersonResult().size());
+ checkErnpResult(updateResponse.getPersonResult().get(0), addPersonData, 2);
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(), ccSearchPersResult.getBpk());
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), addPersonPersonalIdentifier);
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), ccPersonPersonalIdentifier);
+
+
+
+ // *** search by first personalIdentifier
+ ErnpRegisterResult persIdSearchFirstResp = client.searchWithPersonIdentifier(
+ addPersonPersonalIdentifier, cc);
+ assertNotNull("no ERnP response", persIdSearchFirstResp);
+ assertEquals("wrong resp size", 1, persIdSearchFirstResp.getPersonResult().size());
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(), ccSearchPersResult.getBpk());
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), addPersonPersonalIdentifier);
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), ccPersonPersonalIdentifier);
+ checkErnpResult(updateResponse.getPersonResult().get(0), addPersonData, 2);
+
+
+
+ // *** search by second personalIdentifier
+ ErnpRegisterResult persIdSearchSecondResp = client.searchWithPersonIdentifier(
+ ccPersonPersonalIdentifier, cc);
+ assertNotNull("no ERnP response", persIdSearchSecondResp);
+ assertEquals("wrong resp size", 1, persIdSearchSecondResp.getPersonResult().size());
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(), ccSearchPersResult.getBpk());
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), addPersonPersonalIdentifier);
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), ccPersonPersonalIdentifier);
+ checkErnpResult(updateResponse.getPersonResult().get(0), addPersonData, 2);
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void addSearchAndMdsUpdate() {
+ // *** add new random entry ***
+
+ final String addPersonPersonalIdentifier = RandomStringUtils.randomAlphanumeric(10);
+ final String cc = "DE";
+ final SimpleEidasData addPersonData = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .givenName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .dateOfBirth("1985-05-05")
+ .personalIdentifier(cc + "/AT/" + addPersonPersonalIdentifier)
+ .pseudonym(addPersonPersonalIdentifier)
+ .birthName(RandomStringUtils.randomAlphabetic(8))
+ .placeOfBirth(RandomStringUtils.randomAlphabetic(8))
+ .build();
+
+ // add entry
+ ErnpRegisterResult addPersonResponse = client.add(addPersonData);
+
+ // verify added entry
+ assertNotNull("no ERnP response", addPersonResponse);
+ assertEquals("wrong resp size", 1, addPersonResponse.getPersonResult().size());
+ checkErnpResult(addPersonResponse.getPersonResult().get(0), addPersonData, 1);
+
+
+ // *** search entry by personalId ***
+ SimpleEidasData mdsHasChanged = addPersonData.toBuilder()
+ .givenName(RandomStringUtils.randomAlphanumeric(10))
+ .familyName(RandomStringUtils.randomAlphanumeric(10))
+ .build();
+
+ // search by personalId
+ ErnpRegisterResult personalIdResponse = client.searchWithPersonIdentifier(addPersonPersonalIdentifier, cc);
+
+ // verify personalId result
+ assertNotNull("no ERnP response", personalIdResponse);
+ assertEquals("wrong resp size", 1, personalIdResponse.getPersonResult().size());
+ RegisterResult persIdSearchResult = personalIdResponse.getPersonResult().get(0);
+ checkErnpResult(personalIdResponse.getPersonResult().get(0), addPersonData, 1);
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(),
+ persIdSearchResult.getBpk());
+ assertFalse("no MDS change detected", mdsHasChanged.equalsRegisterData(persIdSearchResult));
+
+
+ // *** update entry because MDS has changed ***
+ // update ERnP entry
+ ErnpRegisterResult updateResponse = client.update(persIdSearchResult, mdsHasChanged);
+ assertNotNull("no ERnP response", updateResponse);
+ assertEquals("wrong resp size", 1, updateResponse.getPersonResult().size());
+ checkErnpResult(updateResponse.getPersonResult().get(0), mdsHasChanged, 1);
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(), persIdSearchResult.getBpk());
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), addPersonPersonalIdentifier);
+
+
+ // *** search by first personalIdentifier
+ ErnpRegisterResult persIdSearchFirstResp = client.searchWithPersonIdentifier(
+ addPersonPersonalIdentifier, cc);
+ assertNotNull("no ERnP response", persIdSearchFirstResp);
+ assertEquals("wrong resp size", 1, persIdSearchFirstResp.getPersonResult().size());
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(), persIdSearchResult.getBpk());
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), addPersonPersonalIdentifier);
+ checkErnpResult(updateResponse.getPersonResult().get(0), mdsHasChanged, 1);
+
+ // *** search by first personalIdentifier
+ ErnpRegisterResult mdsSearchResp = client.searchWithMds(
+ mdsHasChanged.getGivenName(), mdsHasChanged.getFamilyName(), mdsHasChanged.getDateOfBirth(), cc);
+ assertNotNull("no ERnP response", mdsSearchResp);
+ assertEquals("wrong resp size", 1, mdsSearchResp.getPersonResult().size());
+ assertEquals("wrong bPK", addPersonResponse.getPersonResult().get(0).getBpk(), persIdSearchResult.getBpk());
+ checkPersonalIdentifier(updateResponse.getPersonResult().get(0), addPersonPersonalIdentifier);
+ checkErnpResult(updateResponse.getPersonResult().get(0), mdsHasChanged, 1);
+
+
+
+ }
+
+
+ @Ignore
+ @Test
+ @SneakyThrows
+ public void addErnpEntry() {
+ final String personalIdentifierFirst = "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit";
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("DOPISNÍ")
+ .givenName("DANA")
+ .dateOfBirth("1996-01-01")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.add(eidasDataFirst);
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ checkErnpResult(resp.getPersonResult().get(0), eidasDataFirst, 1);
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void addRandomErnpEntry() {
+ final String addPersonPersonalIdentifier = RandomStringUtils.randomAlphanumeric(10);
+ final String cc = "XZ";
+ final SimpleEidasData addPersonData = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .givenName(TEST_PREFIX + RandomStringUtils.randomAlphabetic(8))
+ .dateOfBirth("1985-05-05")
+ .personalIdentifier(cc + "/AT/" + addPersonPersonalIdentifier)
+ .pseudonym(addPersonPersonalIdentifier)
+ .birthName(RandomStringUtils.randomAlphabetic(8))
+ .placeOfBirth(RandomStringUtils.randomAlphabetic(8))
+ .build();
+
+ // add entry
+ ErnpRegisterResult addPersonResponse = client.add(addPersonData);
+
+ // verify added entry
+ assertNotNull("no ERnP response", addPersonResponse);
+ assertEquals("wrong resp size", 1, addPersonResponse.getPersonResult().size());
+ checkErnpResult(addPersonResponse.getPersonResult().get(0), addPersonData, 1);
+
+ }
+
+
+ private void checkErnpResult(RegisterResult registerResult, final SimpleEidasData eidasData, int numOfPseudonyms) {
+ assertEquals("wrong familyname", eidasData.getFamilyName(), registerResult.getFamilyName());
+ assertEquals("wrong givenname", eidasData.getGivenName(), registerResult.getGivenName());
+ assertEquals("wrong birthday", eidasData.getDateOfBirth(), registerResult.getDateOfBirth());
+ assertEquals("wrong personalId size", numOfPseudonyms, registerResult.getPseudonym().size());
+ assertEquals("wrong placeOfBirth", eidasData.getPlaceOfBirth(), registerResult.getPlaceOfBirth());
+ assertEquals("wrong birthName", eidasData.getBirthName(), registerResult.getBirthName());
+ assertTrue("no bPK", StringUtils.isNotEmpty(registerResult.getBpk()));
+ checkPersonalIdentifier(registerResult, eidasData.getPseudonym());
+
+ }
+
+ private void checkPersonalIdentifier(RegisterResult registerResult, String pseudonym) {
+ assertTrue("wrong or no personalId", registerResult.getPseudonym().stream()
+ .filter(el -> pseudonym.equals(el))
+ .findFirst()
+ .isPresent());
+
+ }
}
--
cgit v1.2.3
From 0d7caf5c248a53610c2133e5cc1755a76d690b40 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Thu, 3 Mar 2022 11:44:29 +0100
Subject: test(ernp): add ERnP client detail tests
---
.../src/test/resources/data/ernp/1_add_req.json | 30 ++++++++
.../src/test/resources/data/ernp/1_add_resp.json | 60 ++++++++++++++++
.../data/ernp/1_kitt_search_latest_req.json | 19 +++++
.../data/ernp/1_kitt_search_latest_resp.json | 62 ++++++++++++++++
.../resources/data/ernp/1_kitt_update_req.json | 17 +++++
.../resources/data/ernp/1_kitt_update_resp.json | 60 ++++++++++++++++
.../data/ernp/1_search_with_personalId_req.json | 20 ++++++
.../data/ernp/1_search_with_personalId_resp.json | 62 ++++++++++++++++
.../src/test/resources/data/ernp/2_add_req.json | 30 ++++++++
.../src/test/resources/data/ernp/2_add_resp.json | 60 ++++++++++++++++
.../data/ernp/2_kitt_search_latest_req.json | 19 +++++
.../data/ernp/2_kitt_search_latest_resp.json | 62 ++++++++++++++++
.../resources/data/ernp/2_kitt_update_req.json | 14 ++++
.../resources/data/ernp/2_kitt_update_resp.json | 69 ++++++++++++++++++
.../data/ernp/2_search_with_cc_specific_req.json | 30 ++++++++
.../data/ernp/2_search_with_cc_specific_resp.json | 62 ++++++++++++++++
.../resources/data/ernp/3_search_with_mds_req.json | 18 +++++
.../data/ernp/3_search_with_mds_resp.json | 44 ++++++++++++
.../data/ernp/4_search_with_mds_multi_resp.json | 84 ++++++++++++++++++++++
.../resources/data/ernp/4_search_with_mds_req.json | 18 +++++
.../test/resources/data/ernp/ernp_empty_resp.json | 1 +
.../src/test/resources/data/ernp/error_resp.json | 12 ++++
22 files changed, 853 insertions(+)
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_multi_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_req.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/ernp_empty_resp.json
create mode 100644 eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/error_resp.json
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_req.json
new file mode 100644
index 00000000..4f823c60
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_req.json
@@ -0,0 +1,30 @@
+{
+ "begruendung": "Add new person",
+ "personendaten": {
+ "familienname": "CtKKrtUe",
+ "vorname": "dUeYzUFg",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ }
+ },
+ "anschrift": null,
+ "eidas": [
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "wert": "Y8ADWaeh0h",
+ "staatscode2": "DE"
+ },
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "wert": "hrFevCfP",
+ "staatscode2": "DE"
+ },
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "wert": "sNUEAhEr",
+ "staatscode2": "DE"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_resp.json
new file mode 100644
index 00000000..139483cf
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_add_resp.json
@@ -0,0 +1,60 @@
+{
+ "person": {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000486",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "Y8ADWaeh0h"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000488",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "hrFevCfP"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000490",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "sNUEAhEr"
+ }
+ ],
+ "entityId": "1933000000000475",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:07:28.885+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000482591530",
+ "bpkZp": "+OQnljn0Son1W2rkM73nP/VMsvc=",
+ "entityId": "1933000000000475",
+ "familienname": "CtKKrtUe",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "vorname": "dUeYzUFg"
+ },
+ "version": "2022-03-03T11:07:28.885+01:00"
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_req.json
new file mode 100644
index 00000000..2538ebac
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_req.json
@@ -0,0 +1,19 @@
+{
+ "begruendung": "KITT get-latest-version",
+ "suchoptionen": {
+ "historisch": "AktuellUndHistorisch",
+ "sucheMitNamensteilen": false,
+ "suchwizard": false,
+ "zmr": false
+ },
+ "suchdaten": {
+ "bpkZp": "+OQnljn0Son1W2rkM73nP/VMsvc=",
+ "familienname": "CtKKrtUe",
+ "vorname": "dUeYzUFg",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ }
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_resp.json
new file mode 100644
index 00000000..588153cd
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_search_latest_resp.json
@@ -0,0 +1,62 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000486",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "Y8ADWaeh0h"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000488",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "hrFevCfP"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000490",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "sNUEAhEr"
+ }
+ ],
+ "entityId": "1933000000000475",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:07:28.885+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000482591530",
+ "bpkZp": "+OQnljn0Son1W2rkM73nP/VMsvc=",
+ "entityId": "1933000000000475",
+ "familienname": "CtKKrtUe",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "vorname": "dUeYzUFg"
+ },
+ "version": "2022-03-03T11:07:28.885+01:00"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_req.json
new file mode 100644
index 00000000..194fba1d
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_req.json
@@ -0,0 +1,17 @@
+{
+ "begruendung": "KITT update dataset",
+ "aendern": {
+ "personendaten": {
+ "entityId": "1933000000000475",
+ "familienname": "mVzTMpig6r",
+ "vorname": "Jb2vj1Xpql",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ }
+ }
+ },
+ "entityId": "1933000000000475",
+ "version": "2022-03-03T10:07:28.885Z"
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_resp.json
new file mode 100644
index 00000000..7fe9210a
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_kitt_update_resp.json
@@ -0,0 +1,60 @@
+{
+ "person": {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000486",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "Y8ADWaeh0h"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000488",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "hrFevCfP"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000490",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "sNUEAhEr"
+ }
+ ],
+ "entityId": "1933000000000475",
+ "gueltigAb": "2022-03-03T11:07:29.751+01:00",
+ "letzteOperation": {
+ "begruendung": "KITT update dataset",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAendern",
+ "zeitpunkt": "2022-03-03T11:07:29.751+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000482591530",
+ "bpkZp": "+OQnljn0Son1W2rkM73nP/VMsvc=",
+ "entityId": "1933000000000475",
+ "familienname": "mVzTMpig6r",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:07:29.751+01:00",
+ "vorname": "Jb2vj1Xpql"
+ },
+ "version": "2022-03-03T11:07:29.751+01:00"
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_req.json
new file mode 100644
index 00000000..d7344f08
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_req.json
@@ -0,0 +1,20 @@
+{
+ "begruendung": "Searching PersonIdentifier",
+ "suchoptionen": {
+ "historisch": "AktuellUndHistorisch",
+ "sucheMitNamensteilen": false,
+ "suchwizard": false,
+ "zmr": false
+ },
+ "suchdaten": {
+ "familienname": null,
+ "vorname": null,
+ "eidas": [
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "wert": "Y8ADWaeh0h",
+ "staatscode2": "DE"
+ }
+ ]
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_resp.json
new file mode 100644
index 00000000..588153cd
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/1_search_with_personalId_resp.json
@@ -0,0 +1,62 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000486",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "Y8ADWaeh0h"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000488",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "hrFevCfP"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000490",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "staatscode2": "DE",
+ "wert": "sNUEAhEr"
+ }
+ ],
+ "entityId": "1933000000000475",
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:07:28.885+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000482591530",
+ "bpkZp": "+OQnljn0Son1W2rkM73nP/VMsvc=",
+ "entityId": "1933000000000475",
+ "familienname": "CtKKrtUe",
+ "geburtsdatum": {
+ "jahr": 1985,
+ "monat": 5,
+ "tag": 5
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:07:28.885+01:00",
+ "vorname": "dUeYzUFg"
+ },
+ "version": "2022-03-03T11:07:28.885+01:00"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_req.json
new file mode 100644
index 00000000..35e52c10
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_req.json
@@ -0,0 +1,30 @@
+{
+ "begruendung": "Add new person",
+ "personendaten": {
+ "familienname": "mRjMKAQc",
+ "vorname": "vdqZZIaA",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ }
+ },
+ "anschrift": null,
+ "eidas": [
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "wert": "88hvWzUaIX",
+ "staatscode2": "DE"
+ },
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "wert": "VRNCAylF",
+ "staatscode2": "DE"
+ },
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "wert": "miEklFHC",
+ "staatscode2": "DE"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_resp.json
new file mode 100644
index 00000000..7f85a143
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_add_resp.json
@@ -0,0 +1,60 @@
+{
+ "person": {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000509",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "88hvWzUaIX"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000511",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "VRNCAylF"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000513",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "miEklFHC"
+ }
+ ],
+ "entityId": "1933000000000498",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:14:59.712+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000951265372",
+ "bpkZp": "TBGoMlirU881e2jMGETa9WLx1+A=",
+ "entityId": "1933000000000498",
+ "familienname": "mRjMKAQc",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "vorname": "vdqZZIaA"
+ },
+ "version": "2022-03-03T11:14:59.712+01:00"
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_req.json
new file mode 100644
index 00000000..d3dd0658
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_req.json
@@ -0,0 +1,19 @@
+{
+ "begruendung": "KITT get-latest-version",
+ "suchoptionen": {
+ "historisch": "AktuellUndHistorisch",
+ "sucheMitNamensteilen": false,
+ "suchwizard": false,
+ "zmr": false
+ },
+ "suchdaten": {
+ "bpkZp": "TBGoMlirU881e2jMGETa9WLx1+A=",
+ "familienname": "mRjMKAQc",
+ "vorname": "vdqZZIaA",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ }
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_resp.json
new file mode 100644
index 00000000..24009e64
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_search_latest_resp.json
@@ -0,0 +1,62 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000509",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "88hvWzUaIX"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000511",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "VRNCAylF"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000513",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "miEklFHC"
+ }
+ ],
+ "entityId": "1933000000000498",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:14:59.712+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000951265372",
+ "bpkZp": "TBGoMlirU881e2jMGETa9WLx1+A=",
+ "entityId": "1933000000000498",
+ "familienname": "mRjMKAQc",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "vorname": "vdqZZIaA"
+ },
+ "version": "2022-03-03T11:14:59.712+01:00"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_req.json
new file mode 100644
index 00000000..0e4a9b21
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_req.json
@@ -0,0 +1,14 @@
+{
+ "begruendung": "KITT update dataset",
+ "anlegen": {
+ "eidas": [
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "wert": "nj1m79jm9z",
+ "staatscode2": "DE"
+ }
+ ]
+ },
+ "entityId": "1933000000000498",
+ "version": "2022-03-03T10:14:59.712Z"
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_resp.json
new file mode 100644
index 00000000..23dc74f3
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_kitt_update_resp.json
@@ -0,0 +1,69 @@
+{
+ "person": {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000509",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "88hvWzUaIX"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000511",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "VRNCAylF"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000513",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "miEklFHC"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933100000000607",
+ "gueltigAb": "2022-03-03T11:15:00.762+01:00",
+ "staatscode2": "DE",
+ "wert": "nj1m79jm9z"
+ }
+ ],
+ "entityId": "1933000000000498",
+ "gueltigAb": "2022-03-03T11:15:00.762+01:00",
+ "letzteOperation": {
+ "begruendung": "KITT update dataset",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAendern",
+ "zeitpunkt": "2022-03-03T11:15:00.762+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000951265372",
+ "bpkZp": "TBGoMlirU881e2jMGETa9WLx1+A=",
+ "entityId": "1933000000000498",
+ "familienname": "mRjMKAQc",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "vorname": "vdqZZIaA"
+ },
+ "version": "2022-03-03T11:15:00.762+01:00"
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_req.json
new file mode 100644
index 00000000..d80b0d2e
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_req.json
@@ -0,0 +1,30 @@
+{
+ "begruendung": "Searching DE specific",
+ "suchoptionen": {
+ "historisch": "AktuellUndHistorisch",
+ "sucheMitNamensteilen": false,
+ "suchwizard": false,
+ "zmr": false
+ },
+ "suchdaten": {
+ "familienname": "mRjMKAQc",
+ "vorname": "vdqZZIaA",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "eidas": [
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "wert": "VRNCAylF",
+ "staatscode2": "DE"
+ },
+ {
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "wert": "miEklFHC",
+ "staatscode2": "DE"
+ }
+ ]
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_resp.json
new file mode 100644
index 00000000..24009e64
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/2_search_with_cc_specific_resp.json
@@ -0,0 +1,62 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000509",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "88hvWzUaIX"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000511",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "VRNCAylF"
+ },
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000513",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "staatscode2": "DE",
+ "wert": "miEklFHC"
+ }
+ ],
+ "entityId": "1933000000000498",
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:14:59.712+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000951265372",
+ "bpkZp": "TBGoMlirU881e2jMGETa9WLx1+A=",
+ "entityId": "1933000000000498",
+ "familienname": "mRjMKAQc",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:14:59.712+01:00",
+ "vorname": "vdqZZIaA"
+ },
+ "version": "2022-03-03T11:14:59.712+01:00"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_req.json
new file mode 100644
index 00000000..eb382bc0
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_req.json
@@ -0,0 +1,18 @@
+{
+ "begruendung": "Searching with MDS only",
+ "suchoptionen": {
+ "historisch": "AktuellUndHistorisch",
+ "sucheMitNamensteilen": false,
+ "suchwizard": false,
+ "zmr": false
+ },
+ "suchdaten": {
+ "familienname": "DOPISN[0xc3][0x8d]",
+ "vorname": "DANA",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ }
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json
new file mode 100644
index 00000000..50735f23
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json
@@ -0,0 +1,44 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000058",
+ "gueltigAb": "2022-03-02T16:23:32.743+01:00",
+ "staatscode2": "CZ",
+ "wert": "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit"
+ }
+ ],
+ "entityId": "1933000000000047",
+ "gueltigAb": "2022-03-02T16:23:32.743+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-02T16:23:32.743+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000501189333",
+ "bpkZp": "vypyCkyczK7i+cgPWlJasuJphIA=",
+ "entityId": "1933000000000047",
+ "familienname": "DOPISN[0xc3][0x8d]",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-02T16:23:32.743+01:00",
+ "vorname": "DANA"
+ },
+ "version": "2022-03-02T16:23:32.743+01:00"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_multi_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_multi_resp.json
new file mode 100644
index 00000000..87a23647
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_multi_resp.json
@@ -0,0 +1,84 @@
+{
+ "person": [
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933000000000653",
+ "gueltigAb": "2022-03-03T11:27:57.651+01:00",
+ "staatscode2": "XZ",
+ "wert": "ybgLmbYGxU"
+ }
+ ],
+ "entityId": "1933000000000642",
+ "gueltigAb": "2022-03-03T11:27:57.651+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:27:57.651+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000693812023",
+ "bpkZp": "QJ/5YLEbOCfRhG5R0KKHNnmeMYo=",
+ "entityId": "1933000000000642",
+ "familienname": "HjecFKGu",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:27:57.651+01:00",
+ "vorname": "QwnAMXsJ"
+ },
+ "version": "2022-03-03T11:27:57.651+01:00"
+ },
+ {
+ "type": "Person",
+ "eidas": [
+ {
+ "ablaufDatum": "9999-12-31T00:00:00.000+01:00",
+ "art": "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier",
+ "ausstellDatum": "9999-12-31T00:00:00.000+01:00",
+ "entityId": "1933100000000762",
+ "gueltigAb": "2022-03-03T11:27:57.885+01:00",
+ "staatscode2": "XZ",
+ "wert": "rEhBYWgiSx"
+ }
+ ],
+ "entityId": "1933100000000751",
+ "gueltigAb": "2022-03-03T11:27:57.885+01:00",
+ "letzteOperation": {
+ "begruendung": "Add new person",
+ "durchgefuehrtVon": {
+ "behoerdenkennzeichen": "380630",
+ "benutzer": "eidtapp@bmi.gv.at"
+ },
+ "vorgang": "PersonAnlegen",
+ "zeitpunkt": "2022-03-03T11:27:57.885+01:00"
+ },
+ "personendaten": {
+ "basiszahl": "000803465934",
+ "bpkZp": "ZaJ2Yvx0u/z8VqNyCJ8zKT8XQa0=",
+ "entityId": "1933100000000751",
+ "familienname": "HjecFKGu",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ },
+ "geprueft": false,
+ "gueltigAb": "2022-03-03T11:27:57.885+01:00",
+ "vorname": "QwnAMXsJ"
+ },
+ "version": "2022-03-03T11:27:57.885+01:00"
+ }
+ ]
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_req.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_req.json
new file mode 100644
index 00000000..01c3c3f9
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/4_search_with_mds_req.json
@@ -0,0 +1,18 @@
+{
+ "begruendung": "Searching with MDS only",
+ "suchoptionen": {
+ "historisch": "AktuellUndHistorisch",
+ "sucheMitNamensteilen": false,
+ "suchwizard": false,
+ "zmr": false
+ },
+ "suchdaten": {
+ "familienname": "HjecFKGu",
+ "vorname": "QwnAMXsJ",
+ "geburtsdatum": {
+ "jahr": 1996,
+ "monat": 1,
+ "tag": 1
+ }
+ }
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/ernp_empty_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/ernp_empty_resp.json
new file mode 100644
index 00000000..0967ef42
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/ernp_empty_resp.json
@@ -0,0 +1 @@
+{}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/error_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/error_resp.json
new file mode 100644
index 00000000..76e3e7ba
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/error_resp.json
@@ -0,0 +1,12 @@
+{
+ "faultDetails": {
+ "fault": [
+ {
+ "key": "suchdaten",
+ "message": "Mindestsuchkriterien sind: Vorname & Familienname & Geburtsdatum (statt Familienname kann auch Name vor Ehe angegeben werden) oder mindestens ein Eidas Attribut (Art & Wert & Staat)"
+ }
+ ],
+ "faultNumber": 100
+ },
+ "message": "Validierungsfehler"
+}
--
cgit v1.2.3
From 576344a004328d12aa293ff33fb7a392b825e0bd Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Thu, 3 Mar 2022 15:05:46 +0100
Subject: test(ernp): add ERnP client test with mocked ERnP responses
---
.../eidas/v2/test/clients/ErnpRestClientTest.java | 957 ++++++++++++++++++++-
.../data/ernp/3_search_with_mds_resp.json | 2 +-
2 files changed, 956 insertions(+), 3 deletions(-)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
index 9eb574fd..ab1a502c 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
@@ -3,10 +3,20 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+
+import java.net.HttpURLConnection;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -16,16 +26,22 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
import at.asitplus.eidas.specific.connector.test.config.dummy.MsConnectorDummyConfigMap;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.ErnpRestClient.ErnpRegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.IErnpClient;
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.exception.EidasSAuthenticationException;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.DeSpecificDetailSearchProcessor;
+import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
import lombok.SneakyThrows;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
+import okhttp3.mockwebserver.SocketPolicy;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
@@ -36,7 +52,8 @@ public class ErnpRestClientTest {
@Autowired MsConnectorDummyConfigMap basicConfig;
@Autowired IErnpClient client;
-
+
+ private static ObjectMapper mapper = new ObjectMapper();
private static MockWebServer mockWebServer;
/**
@@ -59,6 +76,19 @@ public class ErnpRestClientTest {
}
+ /**
+ * jUnit test initializer.
+ *
+ * @throws InterruptedException in case of an error
+ */
+ @Before
+ public void initialize() throws InterruptedException {
+ mockWebServer.takeRequest(2, TimeUnit.MILLISECONDS);
+ TransactionIdUtils.setTransactionId(UUID.randomUUID().toString());
+
+ }
+
+
@Test
@SneakyThrows
public void searchWithPersonalIdentifierServerError() {
@@ -82,6 +112,7 @@ public class ErnpRestClientTest {
() -> client.searchWithPersonIdentifier(
eidasDataFirst.getPseudonym(), eidasDataFirst.getCitizenCountryCode()));
+ mockWebServer.takeRequest();
assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
}
@@ -122,9 +153,931 @@ public class ErnpRestClientTest {
assertNotNull("no ERnP response", resp);
assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchResidence() {
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithResidenceData(null, null, null, null, null, null);
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsNoResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ mockWebServer.enqueue(new MockResponse()
+ .setSocketPolicy(SocketPolicy.NO_RESPONSE)
+ .setResponseCode(HttpURLConnection.HTTP_NO_CONTENT));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(), eidasDataFirst.getDateOfBirth(), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsErrorResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(400)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/error_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(), eidasDataFirst.getDateOfBirth(), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsNoResult() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/ernp_empty_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(), eidasDataFirst.getDateOfBirth(), cc);
+
+ // validate request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "Searching with MDS only");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkJsonElement(person, "familienname", eidasDataFirst.getFamilyName());
+ checkJsonElement(person, "vorname", eidasDataFirst.getGivenName());
+ checkPersonDateOfBirth(person, eidasDataFirst.getDateOfBirth());
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsSingleResult() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/3_search_with_mds_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(), eidasDataFirst.getDateOfBirth(), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
RegisterResult persInfo = resp.getPersonResult().get(0);
- assertEquals("wrong familyname", "XXXSZR", persInfo.getFamilyName());
+ assertEquals("wrong familyname", "DOPISNÍ", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "DANA", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1996-01-01", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "vypyCkyczK7i+cgPWlJasuJphIA=", persInfo.getBpk());
+ assertEquals("wrong pseudonym", "7cEYWithDEElementsasdfsafsaf4CDVzNT4E7cjkU4VqForjUnit", persInfo.getPseudonym().get(0));
+ assertNull("placeOfBirth", persInfo.getPlaceOfBirth());
+ assertNull("birthName", persInfo.getBirthName());
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithMdsMultiResult() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/4_search_with_mds_multi_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithMds(eidasDataFirst.getGivenName(), eidasDataFirst.getFamilyName(), eidasDataFirst.getDateOfBirth(), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 2, resp.getPersonResult().size());
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdNoResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ mockWebServer.enqueue(new MockResponse()
+ .setSocketPolicy(SocketPolicy.NO_RESPONSE)
+ .setResponseCode(HttpURLConnection.HTTP_NO_CONTENT));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdErrorResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(400)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/error_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdNoResult() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/ernp_empty_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc);
+
+ // validate request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "Searching PersonIdentifier");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkEidasDocument(person, "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasDataFirst.getPseudonym());
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdSingleResult() {
+ final String cc = "DE";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_search_with_personalId_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1985-05-05", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "+OQnljn0Son1W2rkM73nP/VMsvc=", persInfo.getBpk());
+ assertEquals("wrong pseudonym", "Y8ADWaeh0h", persInfo.getPseudonym().get(0));
+ assertEquals("wrong placeOfBirth", "hrFevCfP", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "sNUEAhEr", persInfo.getBirthName());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdSingleResultCountryNoMatch() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_search_with_personalId_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1985-05-05", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "+OQnljn0Son1W2rkM73nP/VMsvc=", persInfo.getBpk());
+ assertTrue("pseudonym", persInfo.getPseudonym().isEmpty());
+ assertNull("placeOfBirth", persInfo.getPlaceOfBirth());
+ assertNull("birthName", persInfo.getBirthName());
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void searchWithPersonalIdMultiResult() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/4_search_with_mds_multi_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchWithPersonIdentifier(eidasDataFirst.getPseudonym(), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.03", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void searchWithCcspecificsNoResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ mockWebServer.enqueue(new MockResponse()
+ .setSocketPolicy(SocketPolicy.NO_RESPONSE)
+ .setResponseCode(HttpURLConnection.HTTP_NO_CONTENT));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchCountrySpecific(new DeSpecificDetailSearchProcessor().generateSearchRequest(eidasDataFirst), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithCcspecificsErrorResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(400)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/error_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchCountrySpecific(new DeSpecificDetailSearchProcessor().generateSearchRequest(eidasDataFirst), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithCcspecificsNoResult() {
+ final String cc = "DE";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc).toBuilder()
+ .birthName(RandomStringUtils.randomAlphabetic(5))
+ .placeOfBirth(RandomStringUtils.randomAlphabetic(5))
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/ernp_empty_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchCountrySpecific(
+ new DeSpecificDetailSearchProcessor().generateSearchRequest(eidasDataFirst), cc);
+
+ // validate request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "Searching DE specific");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkJsonElement(person, "familienname", eidasDataFirst.getFamilyName());
+ checkJsonElement(person, "vorname", eidasDataFirst.getGivenName());
+ checkPersonDateOfBirth(person, eidasDataFirst.getDateOfBirth());
+ checkEidasDocument(person, "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth", cc, eidasDataFirst.getPlaceOfBirth());
+ checkEidasDocument(person, "http://eidas.europa.eu/attributes/naturalperson/BirthName", cc, eidasDataFirst.getBirthName());
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 0, resp.getPersonResult().size());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithCcspecificsSingleResult() {
+ final String cc = "DE";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_search_with_personalId_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchCountrySpecific(
+ new DeSpecificDetailSearchProcessor().generateSearchRequest(eidasDataFirst), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1985-05-05", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "+OQnljn0Son1W2rkM73nP/VMsvc=", persInfo.getBpk());
+ assertEquals("wrong pseudonym", "Y8ADWaeh0h", persInfo.getPseudonym().get(0));
+ assertEquals("wrong placeOfBirth", "hrFevCfP", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "sNUEAhEr", persInfo.getBirthName());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void searchWithCcspecificsSingleResultCountryNoMatch() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_search_with_personalId_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ ErnpRegisterResult resp = client.searchCountrySpecific(
+ new DeSpecificDetailSearchProcessor().generateSearchRequest(eidasDataFirst), cc);
+
+ // validate state
+ mockWebServer.takeRequest();
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "CtKKrtUe", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "dUeYzUFg", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1985-05-05", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "+OQnljn0Son1W2rkM73nP/VMsvc=", persInfo.getBpk());
+ assertTrue("pseudonym", persInfo.getPseudonym().isEmpty());
+ assertNull("placeOfBirth", persInfo.getPlaceOfBirth());
+ assertNull("birthName", persInfo.getBirthName());
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void searchWithCcspecificsMultiResult() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/4_search_with_mds_multi_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.searchCountrySpecific(new DeSpecificDetailSearchProcessor().generateSearchRequest(eidasDataFirst), cc));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.03", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void addPersonNoResponse() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ mockWebServer.enqueue(new MockResponse()
+ .setSocketPolicy(SocketPolicy.NO_RESPONSE)
+ .setResponseCode(HttpURLConnection.HTTP_NO_CONTENT));
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.add(eidasDataFirst));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.11", error.getErrorId());
+ mockWebServer.takeRequest();
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void addPersonSimpleSuccess() {
+ final String cc = "CZ";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc);
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_add_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ // execute operation
+ ErnpRegisterResult resp = client.add(eidasDataFirst);
+
+ // validate request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkJsonElement(reqJson, "begruendung", "Add new person");
+ JsonNode person = getJsonObject(reqJson, "personendaten");
+ checkJsonElement(person, "familienname", eidasDataFirst.getFamilyName());
+ checkJsonElement(person, "vorname", eidasDataFirst.getGivenName());
+ checkPersonDateOfBirth(person, eidasDataFirst.getDateOfBirth());
+ checkEidasDocument(reqJson, "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasDataFirst.getPseudonym());
+ checkEidasDocument(reqJson, "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth", cc);
+ checkEidasDocument(reqJson, "http://eidas.europa.eu/attributes/naturalperson/BirthName", cc);
+
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "mRjMKAQc", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "vdqZZIaA", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1996-01-01", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "TBGoMlirU881e2jMGETa9WLx1+A=", persInfo.getBpk());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void addPersonSimpleComplexe() {
+ final String cc = "DE";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc).toBuilder()
+ .birthName(RandomStringUtils.randomAlphabetic(5))
+ .placeOfBirth(RandomStringUtils.randomAlphabetic(5))
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_add_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute operation
+ // execute operation
+ ErnpRegisterResult resp = client.add(eidasDataFirst);
+
+ // validate request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkJsonElement(reqJson, "begruendung", "Add new person");
+ JsonNode person = getJsonObject(reqJson, "personendaten");
+ checkJsonElement(person, "familienname", eidasDataFirst.getFamilyName());
+ checkJsonElement(person, "vorname", eidasDataFirst.getGivenName());
+ checkPersonDateOfBirth(person, eidasDataFirst.getDateOfBirth());
+ checkEidasDocument(reqJson, "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasDataFirst.getPseudonym());
+ checkEidasDocument(reqJson, "http://eidas.europa.eu/attributes/naturalperson/PlaceOfBirth", cc, eidasDataFirst.getPlaceOfBirth());
+ checkEidasDocument(reqJson, "http://eidas.europa.eu/attributes/naturalperson/BirthName", cc, eidasDataFirst.getBirthName());
+
+ // validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", "mRjMKAQc", persInfo.getFamilyName());
+ assertEquals("wrong givenName", "vdqZZIaA", persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", "1996-01-01", persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", "TBGoMlirU881e2jMGETa9WLx1+A=", persInfo.getBpk());
+ assertEquals("wrong pseudonym", "88hvWzUaIX", persInfo.getPseudonym().get(0));
+ assertEquals("wrong placeOfBirth", "VRNCAylF", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "miEklFHC", persInfo.getBirthName());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void updateNoLatestVersion() {
+ final String cc = "DE";
+ final SimpleEidasData eidasDataFirst = generateRandomEidasData(cc).toBuilder()
+ .birthName(RandomStringUtils.randomAlphabetic(5))
+ .placeOfBirth(RandomStringUtils.randomAlphabetic(5))
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/ernp_empty_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ RegisterResult ernpResult = RegisterResult.builder()
+ .familyName(eidasDataFirst.getFamilyName())
+ .givenName(eidasDataFirst.getGivenName())
+ .dateOfBirth(eidasDataFirst.getDateOfBirth())
+ .bpk("")
+ .pseudonym(Arrays.asList(eidasDataFirst.getPseudonym()))
+ .build();
+
+ // execute operation
+ EidasSAuthenticationException error = assertThrows("wrong Exception", EidasSAuthenticationException.class,
+ () -> client.update(ernpResult, eidasDataFirst));
+ assertEquals("wrong errorCode", "module.eidasauth.matching.03", error.getErrorId());
+ mockWebServer.takeRequest();
+
+
+ }
+
+
+ @Test
+ @SneakyThrows
+ public void updateNoUpdateRequired() {
+ final String cc = "DE";
+ final String personalIdentifierFirst = "Y8ADWaeh0h";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("CtKKrtUe")
+ .givenName("dUeYzUFg")
+ .dateOfBirth("1985-05-05")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_kitt_search_latest_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ RegisterResult ernpResult = RegisterResult.builder()
+ .familyName(eidasDataFirst.getFamilyName())
+ .givenName(eidasDataFirst.getGivenName())
+ .dateOfBirth(eidasDataFirst.getDateOfBirth())
+ .bpk("+OQnljn0Son1W2rkM73nP/VMsvc=")
+ .pseudonym(Arrays.asList(eidasDataFirst.getPseudonym()))
+ .birthName("sNUEAhEr")
+ .placeOfBirth("hrFevCfP")
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.update(ernpResult, eidasDataFirst);
+
+ // validate request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "KITT get-latest-version");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkJsonElement(person, "familienname", ernpResult.getFamilyName());
+ checkJsonElement(person, "vorname", ernpResult.getGivenName());
+ checkJsonElement(person, "bpkZp", ernpResult.getBpk());
+ checkPersonDateOfBirth(person, ernpResult.getDateOfBirth());
+
+ //validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", ernpResult.getFamilyName(), persInfo.getFamilyName());
+ assertEquals("wrong givenName", ernpResult.getGivenName(), persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", ernpResult.getDateOfBirth(), persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", ernpResult.getBpk(), persInfo.getBpk());
+ assertEquals("wrong pseudonym", ernpResult.getPseudonym().get(0), persInfo.getPseudonym().get(0));
+ assertEquals("wrong placeOfBirth", "hrFevCfP", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "sNUEAhEr", persInfo.getBirthName());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void updateUpdateRequiredMds() {
+ final String cc = "DE";
+ final String personalIdentifierFirst = "Y8ADWaeh0h";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("mVzTMpig6r")
+ .givenName("Jb2vj1Xpql")
+ .dateOfBirth("1985-05-05")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .placeOfBirth("hrFevCfP")
+ .birthName("sNUEAhEr")
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_kitt_search_latest_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/1_kitt_update_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ RegisterResult ernpResult = RegisterResult.builder()
+ .familyName("CtKKrtUe")
+ .givenName("dUeYzUFg")
+ .dateOfBirth("1985-05-05")
+ .bpk("+OQnljn0Son1W2rkM73nP/VMsvc=")
+ .pseudonym(Arrays.asList("Y8ADWaeh0h"))
+ .birthName("sNUEAhEr")
+ .placeOfBirth("hrFevCfP")
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.update(ernpResult, eidasDataFirst);
+
+ // validate request
+ // check get-latest-version request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "KITT get-latest-version");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkJsonElement(person, "familienname", ernpResult.getFamilyName());
+ checkJsonElement(person, "vorname", ernpResult.getGivenName());
+ checkJsonElement(person, "bpkZp", ernpResult.getBpk());
+ checkPersonDateOfBirth(person, ernpResult.getDateOfBirth());
+
+ // check update request
+ final RecordedRequest requestKitt = mockWebServer.takeRequest();
+ String reqBodyKitt = requestKitt.getBody().readUtf8();
+ assertFalse("no request body", reqBodyKitt.isEmpty());
+ JsonNode reqJsonKitt = mapper.readTree(reqBodyKitt);
+ checkJsonElement(reqJsonKitt, "begruendung", "KITT update dataset");
+ checkJsonElement(reqJsonKitt, "entityId", "1933000000000475");
+ checkJsonElement(reqJsonKitt, "version", "2022-03-03T10:07:28.885Z");
+ JsonNode personChange = getJsonObject(reqJsonKitt, "aendern");
+ JsonNode personKitt = getJsonObject(personChange, "personendaten");
+ checkJsonElement(personKitt, "familienname", eidasDataFirst.getFamilyName());
+ checkJsonElement(personKitt, "vorname", eidasDataFirst.getGivenName());
+ checkPersonDateOfBirth(personKitt, eidasDataFirst.getDateOfBirth());
+
+ assertFalse("find 'aendern' element", reqJsonKitt.has("anlegen"));
+ assertFalse("find 'aendern' element", personChange.has("eidas"));
+
+
+ //validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", eidasDataFirst.getFamilyName(), persInfo.getFamilyName());
+ assertEquals("wrong givenName", eidasDataFirst.getGivenName(), persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", ernpResult.getDateOfBirth(), persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", ernpResult.getBpk(), persInfo.getBpk());
+ assertEquals("wrong pseudonym", ernpResult.getPseudonym().get(0), persInfo.getPseudonym().get(0));
+ assertEquals("wrong placeOfBirth", "hrFevCfP", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "sNUEAhEr", persInfo.getBirthName());
+
+ }
+
+ @Test
+ @SneakyThrows
+ public void updateUpdateRequiredEidasDocs() {
+ final String cc = "DE";
+ final String personalIdentifierFirst = "nj1m79jm9z";
+ final SimpleEidasData eidasDataFirst = SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName("mRjMKAQc")
+ .givenName("vdqZZIaA")
+ .dateOfBirth("1996-01-01")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .birthName(RandomStringUtils.randomAlphabetic(10))
+ .build();
+
+ // set ERnP response
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_kitt_search_latest_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_kitt_update_resp.json"),
+ "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ RegisterResult ernpResult = RegisterResult.builder()
+ .familyName("mRjMKAQc")
+ .givenName("vdqZZIaA")
+ .dateOfBirth("1996-01-01")
+ .bpk("TBGoMlirU881e2jMGETa9WLx1+A=")
+ .pseudonym(Arrays.asList("88hvWzUaIX"))
+ .birthName("VRNCAylF")
+ .placeOfBirth("miEklFHC")
+ .build();
+
+ // execute operation
+ ErnpRegisterResult resp = client.update(ernpResult, eidasDataFirst);
+
+ // validate request
+ // check get-latest-version request
+ final RecordedRequest request = mockWebServer.takeRequest();
+ String reqBody = request.getBody().readUtf8();
+ assertFalse("no request body", reqBody.isEmpty());
+ JsonNode reqJson = mapper.readTree(reqBody);
+ checkSearchOptions(reqJson, "KITT get-latest-version");
+ JsonNode person = getJsonObject(reqJson, "suchdaten");
+ checkJsonElement(person, "familienname", ernpResult.getFamilyName());
+ checkJsonElement(person, "vorname", ernpResult.getGivenName());
+ checkJsonElement(person, "bpkZp", ernpResult.getBpk());
+ checkPersonDateOfBirth(person, ernpResult.getDateOfBirth());
+
+ // check update request
+ final RecordedRequest requestKitt = mockWebServer.takeRequest();
+ String reqBodyKitt = requestKitt.getBody().readUtf8();
+ assertFalse("no request body", reqBodyKitt.isEmpty());
+ JsonNode reqJsonKitt = mapper.readTree(reqBodyKitt);
+ checkJsonElement(reqJsonKitt, "begruendung", "KITT update dataset");
+ checkJsonElement(reqJsonKitt, "entityId", "1933000000000498");
+ checkJsonElement(reqJsonKitt, "version", "2022-03-03T10:14:59.712Z");
+ JsonNode personChange = getJsonObject(reqJsonKitt, "anlegen");
+ checkEidasDocument(personChange, "http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier", cc, eidasDataFirst.getPseudonym());
+ assertFalse("find 'aendern' element", reqJsonKitt.has("aendern"));
+
+ //validate state
+ assertNotNull("no ERnP response", resp);
+ assertEquals("wrong resp size", 1, resp.getPersonResult().size());
+ RegisterResult persInfo = resp.getPersonResult().get(0);
+ assertEquals("wrong familyname", eidasDataFirst.getFamilyName(), persInfo.getFamilyName());
+ assertEquals("wrong givenName", eidasDataFirst.getGivenName(), persInfo.getGivenName());
+ assertEquals("wrong dateOfBirth", ernpResult.getDateOfBirth(), persInfo.getDateOfBirth());
+ assertEquals("wrong bpk", ernpResult.getBpk(), persInfo.getBpk());
+ assertEquals("wrong pseudonym", ernpResult.getPseudonym().get(0), persInfo.getPseudonym().get(0));
+ assertEquals("wrong pseudonym", eidasDataFirst.getPseudonym(), persInfo.getPseudonym().get(1));
+ assertEquals("wrong placeOfBirth", "VRNCAylF", persInfo.getPlaceOfBirth());
+ assertEquals("wrong birthName", "miEklFHC", persInfo.getBirthName());
+
+ }
+
+
+ private SimpleEidasData generateRandomEidasData(String cc) {
+ final String personalIdentifierFirst = RandomStringUtils.randomAlphanumeric(10);
+ return SimpleEidasData.builder()
+ .citizenCountryCode(cc)
+ .familyName(RandomStringUtils.randomAlphanumeric(10))
+ .givenName(RandomStringUtils.randomAlphanumeric(10))
+ .dateOfBirth("1996-10-15")
+ .personalIdentifier(cc + "/AT/" + personalIdentifierFirst)
+ .pseudonym(personalIdentifierFirst)
+ .build();
+
+ }
+
+ private void checkEidasDocument(JsonNode person, String art, String cc, String expected) {
+ assertTrue("no element: eidas", person.has("eidas"));
+ assertTrue("wrong type element: eidas", person.get("eidas").isArray());
+
+ boolean found = false;
+ Iterator docs = person.get("eidas").elements();
+ while (docs.hasNext() && !found) {
+ JsonNode el = docs.next();
+ assertTrue("art", el.has("art"));
+ assertTrue("wert", el.has("wert"));
+ assertTrue("cc", el.has("staatscode2"));
+ found = art.equals(el.get("art").asText()) && cc.equals(el.get("staatscode2").asText())
+ && expected.equals(el.get("wert").asText());
+
+ }
+ assertTrue("Missing eidas document", found);
+
+ }
+
+ private void checkEidasDocument(JsonNode person, String art, String cc) {
+ assertTrue("no element: eidas", person.has("eidas"));
+ assertTrue("wrong type element: eidas", person.get("eidas").isArray());
+
+ boolean found = false;
+ Iterator docs = person.get("eidas").elements();
+ while (docs.hasNext() && !found) {
+ JsonNode el = docs.next();
+ assertTrue("art", el.has("art"));
+ assertTrue("wert", el.has("wert"));
+ assertTrue("cc", el.has("staatscode2"));
+ found = art.equals(el.get("art").asText()) && cc.equals(el.get("staatscode2").asText());
+
+ }
+ assertFalse("Missing eidas document", found);
+
+ }
+
+ private void checkPersonDateOfBirth(JsonNode person, String dateOfBirth) {
+ JsonNode birthDay = getJsonObject(person, "geburtsdatum");
+ String[] el = dateOfBirth.split("-");
+ checkJsonElement(birthDay, "jahr", Integer.parseInt(el[0]));
+ checkJsonElement(birthDay, "monat", Integer.parseInt(el[1]));
+ checkJsonElement(birthDay, "tag", Integer.parseInt(el[2]));
+
+ }
+
+ private void checkSearchOptions(JsonNode json, String reason) {
+ checkJsonElement(json, "begruendung", reason);
+ JsonNode options = getJsonObject(json, "suchoptionen");
+ checkJsonElement(options, "historisch", "AktuellUndHistorisch");
+ checkJsonElement(options, "sucheMitNamensteilen", false);
+ checkJsonElement(options, "suchwizard", false);
+ checkJsonElement(options, "zmr", false);
+
+ }
+
+ private JsonNode getJsonObject(JsonNode json, String key) {
+ assertTrue("no element: " + key, json.has(key));
+ assertTrue("wrong type element: " + key, json.get(key).isObject());
+ return json.get(key);
+
+ }
+
+ private void checkJsonElement(JsonNode json, String key, int expected) {
+ assertTrue("no element: " + key, json.has(key));
+ assertTrue("wong element-type: " + key, json.get(key).isInt());
+ assertEquals("wong element-value: " + key, expected, json.get(key).asInt());
+
+ }
+
+ private void checkJsonElement(JsonNode json, String key, String expected) {
+ assertTrue("no element: " + key, json.has(key));
+ assertTrue("wong element-type: " + key, json.get(key).isTextual());
+ assertEquals("wong element-value: " + key, expected, json.get(key).asText());
+
+ }
+
+ private void checkJsonElement(JsonNode json, String key, boolean expected) {
+ assertTrue("no element: " + key, json.has(key));
+ assertTrue("wong element-type: " + key, json.get(key).isBoolean());
+ assertEquals("wong element-value: " + key, expected, json.get(key).asBoolean());
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json
index 50735f23..87be362d 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/data/ernp/3_search_with_mds_resp.json
@@ -28,7 +28,7 @@
"basiszahl": "000501189333",
"bpkZp": "vypyCkyczK7i+cgPWlJasuJphIA=",
"entityId": "1933000000000047",
- "familienname": "DOPISN[0xc3][0x8d]",
+ "familienname": "DOPISNÍ",
"geburtsdatum": {
"jahr": 1996,
"monat": 1,
--
cgit v1.2.3
From af4facf80c9a8661dc8aba109219757cff26af98 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Thu, 3 Mar 2022 15:30:54 +0100
Subject: test(ernp): add some ERnP releated tests into InitialSearchTask
---
.../tasks/InitialSearchTaskWithRegistersTest.java | 83 +++++++++++++++++++---
1 file changed, 75 insertions(+), 8 deletions(-)
(limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
index 18d76264..6d0e7c31 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java
@@ -45,6 +45,7 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.jetbrains.annotations.NotNull;
import org.junit.AfterClass;
@@ -84,6 +85,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidPr
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterStatusResults;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients.ErnpRestClientTest;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients.ZmrClientTest;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils;
import at.gv.bmi.namespace.zmr_su.base._20040201.RequestType;
@@ -180,11 +182,6 @@ public class InitialSearchTaskWithRegistersTest {
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
pendingReq = new TestRequestImpl();
-
-
- mockWebServer.enqueue(new MockResponse().setResponseCode(200)
- .setBody("{}")
- .setHeader("Content-Type", "application/json;charset=utf-8"));
}
@@ -218,6 +215,10 @@ public class InitialSearchTaskWithRegistersTest {
//do not make an update because, MDS update is not allowed and no other data has been changed
.thenThrow(new RuntimeException("This request is not needed any more"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}")
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
// execute test
task.execute(pendingReq, executionContext);
@@ -266,6 +267,9 @@ public class InitialSearchTaskWithRegistersTest {
//do make an update because, MDS DOES NOT change, but additional attribute was available
.thenReturn(loadResponseFromFile("/data/zmr/seq_3-6_kitt_update_resp.xml"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}")
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
// execute test
task.execute(pendingReq, executionContext);
@@ -321,6 +325,58 @@ public class InitialSearchTaskWithRegistersTest {
}
+ /**
+ * Find single person in ZMR by country specifics.
+ */
+ @Test
+ @DirtiesContext
+ public void singlePersonFindWithCountySpecifics_Ernp() throws Exception {
+ //inject eIDAS data
+ pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(
+ Constants.DATA_FULL_EIDAS_RESPONSE,
+ buildDummyAuthResponse("vdqZZIaA", "mRjMKAQc",
+ "DE/AT/nj1m79jm9z", "1996-01-01",
+ null, "VRNCAylF", "miEklFHC"));
+
+ final ArgumentCaptor zmrReq = ArgumentCaptor.forClass(RequestType.class);
+ BigInteger processId = new BigInteger("367100000000079");
+
+ // inject response
+ when(zmrMock.service(zmrReq.capture(), any()))
+ .thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //personalId search
+ .thenReturn(loadResponseFromFile("/data/zmr/empty_zmr_result.xml")) //CC specific search
+ .thenThrow(new RuntimeException("This request is not needed any more"));
+
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200) //personalId search
+ .setBody("{}")
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200) //CC specific search
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_search_with_cc_specific_resp.json"), "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200) //KITT search
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_kitt_search_latest_resp.json"), "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200) //KITT update
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/2_kitt_update_resp.json"), "UTF-8"))
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
+ // execute test
+ task.execute(pendingReq, executionContext);
+
+ // validate state
+ checkMatchingSuccessState(pendingReq, "TBGoMlirU881e2jMGETa9WLx1+A=", "mRjMKAQc",
+ "vdqZZIaA", "1996-01-01", DE);
+
+ // validate request
+ assertEquals("wrong number of req.", 2, zmrReq.getAllValues().size());
+ checkBasicRequestParameters(zmrReq.getAllValues().get(0), ZmrClientTest.PROCESS_TASK_SEARCH, null, "jUnit123456");
+ checkBasicRequestParameters(zmrReq.getAllValues().get(1), ZmrClientTest.PROCESS_TASK_SEARCH, processId, "jUnit123456");
+
+ }
+
/**
* Find single person in ZMR by country specifics.
@@ -346,6 +402,10 @@ public class InitialSearchTaskWithRegistersTest {
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-6_kitt_update_resp.xml")) //KITT update
.thenThrow(new RuntimeException("This request is not needed any more"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}")
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
mockWebServer.enqueue(new MockResponse().setResponseCode(200) //CC specific search
.setBody("{}")
.setHeader("Content-Type", "application/json;charset=utf-8"));
@@ -389,7 +449,10 @@ public class InitialSearchTaskWithRegistersTest {
//CC-specific will be ignored because CC is DE but BirthName and PlaceOfBirth is 'null'
.thenReturn(loadResponseFromFile("/data/zmr/seq_1-2_search_with_mds_resp.xml")) //MDS specific search
.thenThrow(new RuntimeException("This request is not needed any more"));
-
+
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}")
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
mockWebServer.enqueue(new MockResponse().setResponseCode(200) //MDS specific search
.setBody("{}")
.setHeader("Content-Type", "application/json;charset=utf-8"));
@@ -432,11 +495,15 @@ public class InitialSearchTaskWithRegistersTest {
.thenThrow(new RuntimeException("This request is not needed any more"));
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}")
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
mockWebServer.enqueue(new MockResponse().setResponseCode(200) //CC specific search
.setBody("{}")
.setHeader("Content-Type", "application/json;charset=utf-8"));
mockWebServer.enqueue(new MockResponse().setResponseCode(200) //MDS specific search
- .setBody("{}")
+ .setBody(IOUtils.toString(
+ ErnpRestClientTest.class.getResourceAsStream("/data/ernp/3_search_with_mds_resp.json"), "UTF-8"))
.setHeader("Content-Type", "application/json;charset=utf-8"));
@@ -444,7 +511,7 @@ public class InitialSearchTaskWithRegistersTest {
task.execute(pendingReq, executionContext);
// validate state
- checkIntermediateResult(2);
+ checkIntermediateResult(3);
// validate request
assertEquals("wrong number of req.", 3, zmrReq.getAllValues().size());
--
cgit v1.2.3