aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/test/java
diff options
context:
space:
mode:
authorThomas <>2022-10-07 17:13:27 +0200
committerThomas <>2022-10-07 17:13:27 +0200
commit2491f68f97b8aa956a1f1e106fa2cf3540d8f86b (patch)
treec933bc073a11c43f39ef418b5e49e146c91c767f /modules/authmodule-eIDAS-v2/src/test/java
parent9da6640b1aa6ffd60866a6f34ea92f70ada1a3e6 (diff)
downloadNational_eIDAS_Gateway-2491f68f97b8aa956a1f1e106fa2cf3540d8f86b.tar.gz
National_eIDAS_Gateway-2491f68f97b8aa956a1f1e106fa2cf3540d8f86b.tar.bz2
National_eIDAS_Gateway-2491f68f97b8aa956a1f1e106fa2cf3540d8f86b.zip
fix(eIDAS-ERnP): eIDAS documents can by 'null' in ERnP response
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/test/java')
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
index 9404b5a5..93d8ab74 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientTest.java
@@ -1054,6 +1054,67 @@ public class ErnpRestClientTest {
}
+ @Test
+ @SneakyThrows
+ public void updateUpdateRequiredAnyEidasDocs() {
+ 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_no_eidas_docs.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
+ mockWebServer.takeRequest();
+
+ // 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());
+ checkEidasDocument(personChange, "http://eidas.europa.eu/attributes/naturalperson/BirthName",
+ cc, eidasDataFirst.getBirthName());
+ assertFalse("find 'aendern' element", reqJsonKitt.has("aendern"));
+
+ }
+
private SimpleEidasData generateRandomEidasData(String cc) {
final String personalIdentifierFirst = RandomStringUtils.randomAlphanumeric(10);