aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java')
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java34
1 files changed, 17 insertions, 17 deletions
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 ce474793..8b34bbef 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
@@ -398,15 +398,14 @@ public class ErnpRestClient implements IErnpClient {
resp.getPerson(), citizenCountryCode, processStepFiendlyname);
} else {
- return processSearchPersonResponse(
- resp.getPerson(), citizenCountryCode);
+ return new ErnpRegisterResult(processSearchPersonResponse(resp.getPerson(), citizenCountryCode));
}
}
}
@Nonnull
- private ErnpRegisterResult processSearchPersonResponse(
+ private List<ErnpPersonRegisterResult> processSearchPersonResponse(
@Nonnull List<Person> list,
@Nonnull String citizenCountryCode) throws EaafAuthenticationException {
final List<ErnpPersonRegisterResult> ernpResult = list.stream()
@@ -414,31 +413,32 @@ public class ErnpRestClient implements IErnpClient {
.filter(Objects::nonNull)
.collect(Collectors.toList());
log.info("Get #{} ERnP results after post-processing", ernpResult.size());
- return new ErnpRegisterResult(ernpResult);
-
+ return ernpResult;
+
}
@NonNull
private ErnpRegisterResult processSearchPersonResponseSingleResult(
@Nonnull List<Person> persons,
@Nonnull String citizenCountryCode, String processStepFiendlyname) throws EaafAuthenticationException {
- if (persons.size() > 1) {
+
+ // process ERnP response and check state of entities
+ List<ErnpPersonRegisterResult> activePersons = processSearchPersonResponse(persons, citizenCountryCode);
+
+ // check final result
+ if (activePersons.isEmpty()) {
+ log.error("ERnP entry, which was selected by matching, looks already closed. "
+ + "Automated operations on closed entries not supported my matching");
+ throw new WorkflowException(processStepFiendlyname,
+ "ERnP entry, which was selected by matching, is not active any more.", true);
+
+ } else if (activePersons.size() > 1) {
log.error("Find more-than-one ERnP entry with search criteria that has to be unique");
throw new WorkflowException(processStepFiendlyname,
"Find more-than-one ERnP entry with search criteria that has to be unique", true);
} else {
- final ErnpPersonRegisterResult activeResult =
- mapErnpResponseToRegisterResult(persons.get(0), citizenCountryCode);
- if (activeResult == null) {
- log.error("ERnP entry, which was selected by matching, looks already closed. "
- + "Automated operations on closed entries not supported my matching");
- throw new WorkflowException(processStepFiendlyname,
- "ERnP entry, which was selected by matching, is not active any more.", true);
-
- }
-
- return new ErnpRegisterResult(Arrays.asList(activeResult));
+ return new ErnpRegisterResult(activePersons);
}
}