aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java
index e180e87d..b4f4098e 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java
@@ -4,6 +4,8 @@ import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
import javax.annotation.Nonnull;
@@ -38,6 +40,9 @@ public class RegisterSearchService {
private static final Object ERNP = "ERnP";
private static final String LOG_MSG_RESULTS = "Matching operation: {} results: "
+ ZMR + ": {} | " + ERNP + ": {}";
+ private static final String LOG_MSG_RESULTS_CLEARING =
+ "Post-processing of register results find duplicated entries. "
+ + "Remove {} entries from " + ERNP + " result.";
private static final String LOG_MSG_KITT = "Matching operation kitts entry on: {}";
@@ -438,9 +443,25 @@ public class RegisterSearchService {
result.getPersonResult(), Collections.emptyList());
}
- static RegisterStatusResults fromZmrAndErnp(ZmrRegisterResult result, ErnpRegisterResult resultErnp) {
+ static RegisterStatusResults fromZmrAndErnp(ZmrRegisterResult result, ErnpRegisterResult resultErnp) {
+ /*
+ * Post-processing of ERnP entries to remove entities that included twice.
+ * In case of KITT on register side that KITTS an ERnP to ZMR entry,
+ * the same entity can part of both responses.
+ */
+ Set<String> existingZmrPersons = result.getPersonResult().stream()
+ .map(el -> el.getBpk())
+ .collect(Collectors.toSet());
+ List<RegisterResult> ernpCleared = resultErnp.getPersonResult().stream()
+ .filter(el -> !existingZmrPersons.contains(el.getBpk()))
+ .collect(Collectors.toList());
+ if (ernpCleared.size() < resultErnp.getPersonResult().size()) {
+ log.info(LOG_MSG_RESULTS_CLEARING, resultErnp.getPersonResult().size() - ernpCleared.size());
+
+ }
+
return new RegisterStatusResults(new RegisterOperationStatus(result.getProcessId()),
- result.getPersonResult(), resultErnp.getPersonResult());
+ result.getPersonResult(), ernpCleared);
}
static RegisterStatusResults fromErnp(RegisterOperationStatus status, ErnpRegisterResult updateErnp) {