From 2491f68f97b8aa956a1f1e106fa2cf3540d8f86b Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 7 Oct 2022 17:13:27 +0200 Subject: fix(eIDAS-ERnP): eIDAS documents can by 'null' in ERnP response --- .../modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java index feb2853a..4212aae8 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java @@ -572,8 +572,12 @@ public class ErnpRestClient implements IErnpClient { } + // get all eIDAS documents from current ERnP entry or an empty list of no exists + List currentEidasDocs = ernpPersonToKitt.getEidas() != null + ? ernpPersonToKitt.getEidas() : Collections.emptyList(); + // check if eIDAS attribute is already includes an eIDAS-Document - boolean alreadyExist = ernpPersonToKitt.getEidas().stream() + boolean alreadyExist = currentEidasDocs.stream() .filter(el -> el.getWert().equals(attrValue) && el.getArt().equals(attrName) && el.getStaatscode2().equals(citizenCountryCode)) @@ -582,7 +586,7 @@ public class ErnpRestClient implements IErnpClient { if (!alreadyExist) { // check eIDAS documents already contains a document with this pair of country-code and attribute-name - Optional oneDocWithNameExists = ernpPersonToKitt.getEidas().stream() + Optional oneDocWithNameExists = currentEidasDocs.stream() .filter(el -> el.getStaatscode2().equals(citizenCountryCode) && el.getArt().equals(attrName)) .findAny(); -- cgit v1.2.3