From 55ab5856a90b065b2a645a62112b380f06cf751c Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 21 Oct 2022 11:11:36 +0200 Subject: feat(matching): distiguish between create ERnP entry by automated process or by user decision --- .../eidas/specific/modules/auth/eidas/v2/Constants.java | 10 ++++++++++ .../modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java | 11 ++++++++++- .../v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java | 5 +++-- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'modules/authmodule-eIDAS-v2/src/main/java') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java index faf38b64..0d0d11f8 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java @@ -336,9 +336,19 @@ public class Constants { /** * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask}. + * + *

In case of an automated decision to create ERnP entry

*/ public static final String TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK = "TASK_CreateNewErnpEntryTask"; + /** + * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask}. + * + *

In case of an user decision to create ERnP entry

+ */ + public static final String TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_BY_USER_TASK = + "TASK_CreateNewErnpEntryByUserTask"; + /** * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateOtherLoginMethodGuiTask}. */ diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java index 563a66ba..5926adc6 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java @@ -23,6 +23,8 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; +import java.io.Serializable; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -93,7 +95,7 @@ public class CreateNewErnpEntryTask extends AbstractAuthServletTask { // finish matching process, because new user-entry uniquly matches log.info("User successfully registerred into ERnP and matching tasks are finished "); - MatchingTaskUtils.setMatchingState(pendingReq, MatchingStates.BY_NEW_ERNP_ENTRY); + MatchingTaskUtils.setMatchingState(pendingReq, selectMatchingStateByContextInfos(executionContext)); MatchingTaskUtils.storeFinalMatchingResult(pendingReq, MatchedPersonResult.generateFormMatchingResult( resp.getPersonResult().get(0), simpleEidasData.getCitizenCountryCode())); @@ -104,4 +106,11 @@ public class CreateNewErnpEntryTask extends AbstractAuthServletTask { } } + private MatchingStates selectMatchingStateByContextInfos(ExecutionContext executionContext) { + Serializable flag = executionContext.get(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_BY_USER_TASK); + return flag != null && (boolean) flag + ? MatchingStates.BY_USER_TO_NEW_ERNP_ENTRY : MatchingStates.BY_NEW_ERNP_ENTRY; + + } + } diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java index 5b966ffe..fb4e6e7b 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java @@ -73,7 +73,8 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN, Constants.TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK, Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, - Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK); + Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK, + Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_BY_USER_TASK); @Override public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, @@ -146,7 +147,7 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe case ADD_ME_AS_NEW: log.info("User selects insert-into-ERnP option. Starting ERnP operation and complete prozess ... "); - executionContext.put(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK, true); + executionContext.put(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_BY_USER_TASK, true); executionContext.put(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, false); return; -- cgit v1.2.3