diff options
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java')
-rw-r--r-- | eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java | 22 |
1 files changed, 19 insertions, 3 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 488b571b..85ea942c 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 @@ -7,6 +7,7 @@ import java.util.List; import javax.annotation.Nonnull; import org.jetbrains.annotations.Nullable; +import org.springframework.lang.NonNull; import org.springframework.stereotype.Service; import com.google.common.collect.Streams; @@ -186,34 +187,49 @@ public class RegisterSearchService { * @param initialEidasData Received eidas data from initial authn * @return */ + @NonNull public RegisterStatusResults step7aKittProcess(RegisterStatusResults registerResult, SimpleEidasData initialEidasData) throws WorkflowException { log.trace("Starting step7aKittProcess"); - // TODO verify with which data this method gets called + + // check if only one single result was found if (registerResult.getResultCount() != 1) { throw new WorkflowException("step7aKittProcess", "getResultCount() != 1"); + } + + // perform updated operation in respect to register results try { if (registerResult.getResultsZmr().size() == 1) { RegisterResult entryZmr = registerResult.getResultsZmr().get(0); ZmrRegisterResult updateZmr = zmrClient .update(registerResult.getOperationStatus().getZmrProcessId(), entryZmr, initialEidasData); return RegisterStatusResults.fromZmr(updateZmr); + } else { RegisterResult entryErnp = registerResult.getResultsErnp().get(0); ErnpRegisterResult updateErnp = ernpClient.update(entryErnp, initialEidasData); return RegisterStatusResults.fromErnp(registerResult.operationStatus, updateErnp); + } } catch (final EidasSAuthenticationException e) { throw new WorkflowException("kittMatchedIdentitiess", e.getMessage(), !(e instanceof ZmrCommunicationException), e); + } } - //TODO: check this method, because it's different to 'step7aKittProcess'??? /** * Automatic process to fix the register entries. * Called when the alternative eIDAS authn leads to a match in a register. + * + * <p>This method perform two additional operations: + * <ul> + * <li>Use bPK to check if <i>altSearchResult</i> is part of <i>initialSearchResult</i>.</li> + * <li>Update register entry twice, be using information from alternative authentication <i>altEidasData</i> + * and from initial authentication <i>initialEidasData</i>.</li> + * </ul> + * </p> * * @param initialSearchResult Register results from initial authentication * @param initialEidasData Received eIDAS data from initial authentication @@ -273,7 +289,7 @@ public class RegisterSearchService { // update ZMR entry by using eIDAS information from alternative authentication ErnpRegisterResult updateAlt = ernpClient.update(entryErnp, altEidasData); - return RegisterStatusResults.fromErnp(altSearchResult.operationStatus, updateAlt); + return RegisterStatusResults.fromErnp(altSearchResult.getOperationStatus(), updateAlt); } } catch (final EidasSAuthenticationException e) { throw new WorkflowException("kittMatchedIdentitiess", e.getMessage(), |