Skip to content

Commit

Permalink
feat: add fast forward suport to skip step authentication flow #3582 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Jan 10, 2023
1 parent 8fd14ef commit 25ee0af
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,16 @@ public SessionId resetToStep(SessionId session, int resetToStep) {
currentStep = StringHelper.toInteger(sessionAttributes.get(io.jans.as.model.config.Constants.AUTH_STEP), currentStep);
}

for (int i = resetToStep; i <= currentStep; i++) {
String key = String.format("auth_step_passed_%d", i);
sessionAttributes.remove(key);
if (resetToStep <= currentStep) {
for (int i = resetToStep; i <= currentStep; i++) {
String key = String.format("auth_step_passed_%d", i);
sessionAttributes.remove(key);
}
} else {
// Scenario when we sckip steps. In this case we need to mark all previous steps as passed
for (int i = currentStep + 1; i < resetToStep; i++) {
sessionAttributes.put(String.format("auth_step_passed_%d", i), Boolean.TRUE.toString());
}
}

sessionAttributes.put(io.jans.as.model.config.Constants.AUTH_STEP, String.valueOf(resetToStep));
Expand Down

0 comments on commit 25ee0af

Please sign in to comment.