diff --git a/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/Constants.java b/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/Constants.java index ac1dbe10a8a4..db63c4439719 100644 --- a/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/Constants.java +++ b/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/Constants.java @@ -33,6 +33,7 @@ public class Constants { public static final String PASSWORD_KEY = "password"; public static final String CONSENT_KEY = "consent"; public static final String PREFERENCE_KEY = "preference"; + public static final String ANONYMOUS_PROFILE_TRACKER = "anonymous_profile_tracker"; // Constants for DataDTO parameters. public static final String REDIRECT_URL = "redirectUrl"; public static final String VALIDATIONS = "validations"; diff --git a/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/FlowExecutionService.java b/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/FlowExecutionService.java index cd9d3d9bf8f0..3cf7c62bd792 100644 --- a/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/FlowExecutionService.java +++ b/components/flow-orchestration-framework/org.wso2.carbon.identity.flow.execution.engine/src/main/java/org/wso2/carbon/identity/flow/execution/engine/FlowExecutionService.java @@ -43,6 +43,7 @@ import java.util.HashMap; import java.util.Map; +import static org.wso2.carbon.identity.flow.execution.engine.Constants.ANONYMOUS_PROFILE_TRACKER; import static org.wso2.carbon.identity.flow.execution.engine.Constants.OTFI; import static org.wso2.carbon.identity.flow.execution.engine.Constants.STATUS_COMPLETE; import static org.wso2.carbon.identity.flow.mgt.Constants.FlowTypes.REGISTRATION; @@ -93,8 +94,9 @@ public FlowExecutionStep executeFlow(String tenantDomain, String applicationId, FlowExecutionContext context = null; boolean isFlowEnteredInIdentityContext = false; GraphConfig graphConfig = null; + boolean isInitiation = StringUtils.isBlank(flowId); try { - if (StringUtils.isBlank(flowId)) { + if (isInitiation) { // No flowId present hence initiate the flow. context = FlowExecutionEngineUtils.initiateContext(tenantDomain, applicationId, flowType); } else { @@ -120,6 +122,15 @@ public FlowExecutionStep executeFlow(String tenantDomain, String applicationId, context.getUserInputData().putAll(inputs); } + // On the initial request of the registration flow, move the anonymous_profile_tracker value (if + // provided) from the user inputs into the flow context properties so that it is retained throughout + // the flow and not treated as a user input during the subsequent input validations. + if (isInitiation && REGISTRATION.getType().equals(context.getFlowType()) + && context.getUserInputData().containsKey(ANONYMOUS_PROFILE_TRACKER)) { + context.setProperty(ANONYMOUS_PROFILE_TRACKER, + context.getUserInputData().remove(ANONYMOUS_PROFILE_TRACKER)); + } + context.setCurrentActionId(actionId); for (FlowExecutionListener listener : FlowExecutionEngineDataHolder.getInstance().getFlowListeners()) {