Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip setting the verified claim for notification less password recovery flows #891

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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 @@ -936,7 +936,7 @@ private HashMap<String, String> getAccountStateClaims(UserRecoveryData userRecov
Enum<RecoveryScenarios> recoveryScenario = userRecoveryData.getRecoveryScenario();
// If notifications are internally managed we try to set the verified claims since this is an opportunity
// to verify a user channel.
if (isNotificationInternallyManaged) {
if (isNotificationInternallyManaged && !isNotificationLessRecoveryMethod(recoveryScenario)) {
if (NotificationChannels.EMAIL_CHANNEL.getChannelType().equals(userRecoveryData.getRemainingSetIds())) {
userClaims.put(NotificationChannels.EMAIL_CHANNEL.getVerifiedClaimUrl(), Boolean.TRUE.toString());
} else if (NotificationChannels.SMS_CHANNEL.getChannelType().equals(userRecoveryData.getRemainingSetIds())) {
Expand Down Expand Up @@ -978,6 +978,20 @@ private HashMap<String, String> getAccountStateClaims(UserRecoveryData userRecov
return userClaims;
}

/**
* Check whether the recovery scenario is notification based.
* A set of recovery scenarios such as question based password recovery, and
* password reset on password expiry does not require sending notifications to the user.
*
* @param recoveryScenario Recovery scenario
* @return True if the recovery scenario does not require sending notifications
*/
private boolean isNotificationLessRecoveryMethod(Enum recoveryScenario) {

return RecoveryScenarios.QUESTION_BASED_PWD_RECOVERY.equals(recoveryScenario) ||
RecoveryScenarios.PASSWORD_EXPIRY.equals(recoveryScenario);
}

/**
* Validate Tenant domain of the user with the domain in the context.
*
Expand Down
Loading