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

Add Username Recovery multichannel support configs #865

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f7220bd
Add configs.
Malith-19 Oct 18, 2024
b4ec8fc
Merge branch 'master' into username-recovery-multichannel-support-con…
Malith-19 Oct 18, 2024
4eac029
Add tests for the configs.
Malith-19 Oct 21, 2024
73454b5
Add tests for the metadata function.
Malith-19 Oct 21, 2024
fd94896
Reformat the code.
Malith-19 Oct 21, 2024
e36b30d
Add unit tests for conditional default values settings.
Malith-19 Oct 22, 2024
a70cfe3
Remove unused imports.
Malith-19 Oct 23, 2024
d48b715
Add logic to handle the username recovery config.
Malith-19 Oct 31, 2024
2e7ea0c
Update the username recovery config handle logic.
Malith-19 Oct 31, 2024
2cfffbe
Update the tests.
Malith-19 Nov 1, 2024
4be3ec0
Update the tests.
Malith-19 Nov 1, 2024
fd7e014
Merge branch 'master' into username-recovery-multichannel-support-con…
Malith-19 Nov 1, 2024
8d5f4c4
Update the doc string.
Malith-19 Nov 2, 2024
a7a13d5
Update the logic of handling the username recovery configs.
Malith-19 Nov 4, 2024
32af364
Add logic to handle non-unique users for username recovery.
Malith-19 Nov 6, 2024
058067b
Update the tests.
Malith-19 Nov 6, 2024
2a7b1a2
Update the username in external channel response.
Malith-19 Nov 6, 2024
d7d23a0
Update the test for notify user.
Malith-19 Nov 6, 2024
c372371
Add channel filtering with configs.
Malith-19 Nov 7, 2024
17fdb79
Remove the duplicate username recovery config validation.
Malith-19 Nov 7, 2024
d0b5a5e
Update the tests.
Malith-19 Nov 7, 2024
fb303a6
Update the license header.
Malith-19 Nov 7, 2024
cf58038
Fix the formatting.
Malith-19 Nov 8, 2024
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 @@ -615,6 +615,8 @@ public static class ConnectorConfig {
public static final String FORCE_ADD_PW_RECOVERY_QUESTION = "Recovery.Question.Password.Forced.Enable";
public static final String FORCE_MIN_NO_QUESTION_ANSWERED = "Recovery.Question.MinQuestionsToAnswer";
public static final String USERNAME_RECOVERY_ENABLE = "Recovery.Notification.Username.Enable";
Malith-19 marked this conversation as resolved.
Show resolved Hide resolved
public static final String USERNAME_RECOVERY_EMAIL_ENABLE = "Recovery.Notification.Username.Email.Enable";
Malith-19 marked this conversation as resolved.
Show resolved Hide resolved
public static final String USERNAME_RECOVERY_SMS_ENABLE = "Recovery.Notification.Username.SMS.Enable";
public static final String USERNAME_RECOVERY_NON_UNIQUE_USERNAME = "Recovery.Notification.Username.NonUniqueUsername";
public static final String QUESTION_CHALLENGE_SEPARATOR = "Recovery.Question.Password.Separator";
public static final String QUESTION_MIN_NO_ANSWER = "Recovery.Question.Password.MinAnswers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ public Map<String, String> getPropertyNameMapping() {
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.QUESTION_MIN_NO_ANSWER, "Number of questions " +
"required for password recovery");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_ENABLE, "Username recovery");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_EMAIL_ENABLE,
"Notification based username recovery via EMAIL");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_SMS_ENABLE,
"Notification based username recovery via SMS");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_RECAPTCHA_ENABLE,
"Enable reCaptcha for username recovery");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.EXPIRY_TIME, "Recovery link expiry time in minutes");
Expand Down Expand Up @@ -193,6 +197,8 @@ public String[] getPropertyNames() {
properties.add(IdentityRecoveryConstants.ConnectorConfig.RECOVERY_QUESTION_PASSWORD_RECAPTCHA_ENABLE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.RECOVERY_QUESTION_PASSWORD_RECAPTCHA_MAX_FAILED_ATTEMPTS);
properties.add(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_ENABLE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_EMAIL_ENABLE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_SMS_ENABLE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_RECAPTCHA_ENABLE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_INTERNALLY_MANAGE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_NOTIFICATION_SUCCESS);
Expand Down Expand Up @@ -227,6 +233,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
String enableRecoveryQuestionPasswordReCaptcha = "true";
String recoveryQuestionPasswordReCaptchaMaxFailedAttempts = "2";
String enableUsernameRecovery = "false";
String enableUsernameRecoveryEmail = "false";
String enableUsernameRecoverySMS = "false";
String enableNotificationInternallyManage = "true";
String expiryTime = "1440";
String expiryTimeSMSOTP = "1";
Expand Down Expand Up @@ -272,6 +280,10 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
ConnectorConfig.RECOVERY_QUESTION_PASSWORD_RECAPTCHA_MAX_FAILED_ATTEMPTS);
String usernameRecovery = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_ENABLE);
String usernameRecoveryEmail = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_EMAIL_ENABLE);
String usernameRecoverySMS = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_SMS_ENABLE);
String notificationInternallyManged = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_INTERNALLY_MANAGE);
String expiryTimeProperty = IdentityUtil.getProperty(IdentityRecoveryConstants.ConnectorConfig.EXPIRY_TIME);
Expand Down Expand Up @@ -351,6 +363,14 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
}
if (StringUtils.isNotEmpty(usernameRecovery)) {
enableUsernameRecovery = usernameRecovery;
// Setting the username recovery value to keep backward compatibility.
enableUsernameRecoveryEmail = usernameRecovery;
}
if (StringUtils.isNotEmpty(usernameRecoveryEmail)){
enableUsernameRecoveryEmail = usernameRecoveryEmail;
}
if (StringUtils.isNotEmpty(usernameRecoverySMS)) {
enableUsernameRecoverySMS = usernameRecoverySMS;
}
if (StringUtils.isNotEmpty(expiryTimeProperty)) {
expiryTime = expiryTimeProperty;
Expand Down Expand Up @@ -433,6 +453,10 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
recoveryQuestionPasswordReCaptchaMaxFailedAttempts);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_ENABLE,
enableUsernameRecovery);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_EMAIL_ENABLE,
enableUsernameRecoveryEmail);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_SMS_ENABLE,
enableUsernameRecoverySMS);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_RECAPTCHA_ENABLE,
enableUsernameRecoveryReCaptcha);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_INTERNALLY_MANAGE,
Expand Down Expand Up @@ -518,6 +542,12 @@ public Map<String, Property> getMetaData() {
meta.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_ENABLE,
getPropertyObject(IdentityMgtConstants.DataTypes.BOOLEAN.getValue()));

meta.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_EMAIL_ENABLE,
getPropertyObject(IdentityMgtConstants.DataTypes.BOOLEAN.getValue()));

meta.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_SMS_ENABLE,
getPropertyObject(IdentityMgtConstants.DataTypes.BOOLEAN.getValue()));

meta.put(IdentityRecoveryConstants.ConnectorConfig.USERNAME_RECOVERY_RECAPTCHA_ENABLE,
getPropertyObject(IdentityMgtConstants.DataTypes.BOOLEAN.getValue()));

Expand Down
Loading
Loading