diff options
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas')
-rw-r--r-- | eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java index cc328b75..232b1d11 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java @@ -63,8 +63,7 @@ public class RegisterSearchService { final List<RegisterResult> resultsErnp = ernpClient.searchWithPersonIdentifier( eidasData.getPersonalIdentifier()); - return new RegisterStatusResults(new RegisterOperationStatus(resultsZmr.getProcessId()), - resultsZmr.getPersonResult(), resultsErnp); + return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultsErnp); } catch (final EidasSAuthenticationException e) { throw new WorkflowException("searchWithPersonalIdentifier", e.getMessage(), @@ -92,8 +91,7 @@ public class RegisterSearchService { ernpClient.searchWithMds(eidasData.getGivenName(), eidasData.getFamilyName(), eidasData .getDateOfBirth()); - return new RegisterStatusResults(new RegisterOperationStatus(resultsZmr.getProcessId()), - resultsZmr.getPersonResult(), resultsErnp); + return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultsErnp); } catch (final EidasSAuthenticationException e) { throw new WorkflowException("searchWithMDSOnly", e.getMessage(), @@ -122,12 +120,11 @@ public class RegisterSearchService { zmrClient.searchCountrySpecific(operationStatus.getZmrProcessId(), ccSpecificProcessor.generateSearchRequest(eidasData), eidasData.getCitizenCountryCode()); - - // TODO: add search procesfor for ERnP searching - return new RegisterStatusResults(operationStatus, resultsZmr.getPersonResult(), Collections.emptyList()); + return RegisterStatusResults.fromZmr(resultsZmr); } else { - return new RegisterStatusResults(operationStatus, Collections.emptyList(), Collections.emptyList()); + // TODO: add search procesfor for ERnP searching + return RegisterStatusResults.fromErnp(operationStatus, Collections.emptyList()); } @@ -152,7 +149,7 @@ public class RegisterSearchService { final ZmrRegisterResult resultsZmr = zmrClient.searchWithResidenceData( operationStatus.getZmrProcessId(), eidasData.getGivenName(), eidasData.getFamilyName(), eidasData.getDateOfBirth(), zipcode, city, street); - return new RegisterStatusResults(operationStatus, resultsZmr.getPersonResult(), Collections.emptyList()); + return RegisterStatusResults.fromZmr(resultsZmr); } @@ -176,13 +173,11 @@ public class RegisterSearchService { RegisterResult entryZmr = registerResult.getResultsZmr().get(0); ZmrRegisterResult updateZmr = zmrClient .update(registerResult.getOperationStatus().getZmrProcessId(), entryZmr, initialEidasData); - return new RegisterStatusResults(registerResult.getOperationStatus(), - updateZmr.getPersonResult(), Collections.emptyList()); + return RegisterStatusResults.fromZmr(updateZmr); } else { RegisterResult entryErnp = registerResult.getResultsErnp().get(0); RegisterResult updateErnp = ernpClient.update(entryErnp, initialEidasData); - return new RegisterStatusResults(registerResult.getOperationStatus(), Collections.emptyList(), - Collections.singletonList(updateErnp)); + return RegisterStatusResults.fromErnp(registerResult.operationStatus, Collections.singletonList(updateErnp)); } } catch (final EidasSAuthenticationException e) { throw new WorkflowException("kittMatchedIdentitiess", e.getMessage(), @@ -283,7 +278,6 @@ public class RegisterSearchService { */ private final List<RegisterResult> resultsErnp; - /** * Get sum of ZMR and ERnP results. * @@ -326,6 +320,20 @@ public class RegisterSearchService { } } + static RegisterStatusResults fromZmr(ZmrRegisterResult result) { + return new RegisterStatusResults(new RegisterOperationStatus(result.getProcessId()), + result.getPersonResult(), Collections.emptyList()); + } + + static RegisterStatusResults fromZmrAndErnp(ZmrRegisterResult result, List<RegisterResult> resultsErnp) { + return new RegisterStatusResults(new RegisterOperationStatus(result.getProcessId()), + result.getPersonResult(), resultsErnp); + } + + static RegisterStatusResults fromErnp(RegisterOperationStatus status, List<RegisterResult> resultsErnp) { + return new RegisterStatusResults(status, Collections.emptyList(), resultsErnp); + } + } } |