Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public FlowExecutionStep executeFlow(String tenantDomain, String applicationId,
}
}

isFlowEnteredInIdentityContext = enterFlowInIdentityContext(context.getFlowType());

if (inputs != null) {
context.getUserInputData().putAll(inputs);
}
Expand All @@ -131,6 +129,8 @@ public FlowExecutionStep executeFlow(String tenantDomain, String applicationId,
context.getUserInputData().remove(ANONYMOUS_PROFILE_TRACKER));
}

isFlowEnteredInIdentityContext = enterFlowInIdentityContext(context);

context.setCurrentActionId(actionId);
for (FlowExecutionListener listener :
FlowExecutionEngineDataHolder.getInstance().getFlowListeners()) {
Expand Down Expand Up @@ -182,8 +182,9 @@ public FlowExecutionStep executeFlow(String tenantDomain, String applicationId,
}
}

private boolean enterFlowInIdentityContext(String flowType) {
private boolean enterFlowInIdentityContext(FlowExecutionContext context) {

String flowType = context.getFlowType();
if (!EnumUtils.isValidEnum(FlowTypes.class, flowType)) {
LOG.warn("Invalid flow type: " + flowType + " provided. Hence not entering the flow in IdentityContext.");
return false;
Expand All @@ -194,6 +195,7 @@ private boolean enterFlowInIdentityContext(String flowType) {
IdentityContext.getThreadLocalIdentityContext().enterFlow(new Flow.Builder()
.name(Flow.Name.REGISTER)
.initiatingPersona(Flow.InitiatingPersona.USER)
.anonymousProfileTracker((String) context.getProperty(ANONYMOUS_PROFILE_TRACKER))
.build());
return true;
case PASSWORD_RECOVERY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,13 @@ public enum CredentialType {
private final Name name;
private final InitiatingPersona initiatingPersona;
private CredentialType credentialType;
private String anonymousProfileTracker;

private Flow(Builder builder) {

this.name = builder.name;
this.initiatingPersona = builder.initiatingPersona;
this.anonymousProfileTracker = builder.anonymousProfileTracker;
}

private Flow(CredentialFlowBuilder builder) {
Expand All @@ -240,6 +242,18 @@ public CredentialType getCredentialType() {
return credentialType;
}

/**
* Returns the anonymous profile tracker identifier associated with the flow, if any.
* This is used to correlate an anonymous, pre-authentication profile (e.g. for external profile linking)
* with the user created/updated as a result of this flow.
*
* @return The anonymous profile tracker identifier, or null if not applicable.
*/
public String getAnonymousProfileTracker() {

return anonymousProfileTracker;
}

/**
* Checks if the given flow name corresponds to a credential flow.
*
Expand All @@ -258,6 +272,7 @@ public static class Builder {

private Name name;
private InitiatingPersona initiatingPersona;
private String anonymousProfileTracker;

public Builder name(Name name) {

Expand All @@ -271,6 +286,12 @@ public Builder initiatingPersona(InitiatingPersona initiatingPersona) {
return this;
}

public Builder anonymousProfileTracker(String anonymousProfileTracker) {

this.anonymousProfileTracker = anonymousProfileTracker;
return this;
}

public Flow build() {

validate();
Expand Down
Loading