Skip to content

Commit

Permalink
Merge pull request #870 from Yoshani/handle-username
Browse files Browse the repository at this point in the history
Add ShowUsernameUnavailability config to self registration
  • Loading branch information
Yoshani authored Oct 22, 2024
2 parents f8d0c11 + 957d049 commit 031c49c
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ public static class ConnectorConfig {
"UseNumbersInOTP";
public static final String SELF_REGISTRATION_OTP_LENGTH = "SelfRegistration.OTP.OTPLength";
public static final String SEND_CONFIRMATION_NOTIFICATION = "SelfRegistration.SendConfirmationOnCreation";
public static final String SHOW_USERNAME_UNAVAILABILITY = "SelfRegistration.ShowUsernameUnavailability";
public static final String SIGN_UP_NOTIFICATION_INTERNALLY_MANAGE = "SelfRegistration.Notification" +
".InternallyManage";
public static final String SELF_REGISTRATION_RE_CAPTCHA = "SelfRegistration.ReCaptcha";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public Map<String, String> getPropertyNameMapping() {
"OTP length");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SEND_CONFIRMATION_NOTIFICATION,
"Enable Account Confirmation On Creation");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SHOW_USERNAME_UNAVAILABILITY,
"Show username unavailability");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SIGN_UP_NOTIFICATION_INTERNALLY_MANAGE,
"Manage notifications sending internally");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_RE_CAPTCHA, "Prompt reCaptcha");
Expand Down Expand Up @@ -144,6 +146,8 @@ public Map<String, String> getPropertyDescriptionMapping() {
"Length of the OTP for SMS and e-mail verifications. OTP length must be 4-10.");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.SEND_CONFIRMATION_NOTIFICATION,
"Enable user account confirmation when the user account is not locked on creation");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.SHOW_USERNAME_UNAVAILABILITY,
"Show a descriptive error message to the user if the username is already taken. However, this may lead to username enumeration");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.SIGN_UP_NOTIFICATION_INTERNALLY_MANAGE,
"Disable if the client application handles notification sending");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_RE_CAPTCHA,
Expand Down Expand Up @@ -184,6 +188,7 @@ public String[] getPropertyNames() {
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_USE_NUMBERS_IN_OTP);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_OTP_LENGTH);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SEND_CONFIRMATION_NOTIFICATION);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SHOW_USERNAME_UNAVAILABILITY);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SIGN_UP_NOTIFICATION_INTERNALLY_MANAGE);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_RE_CAPTCHA);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_VERIFICATION_CODE_EXPIRY_TIME);
Expand All @@ -210,6 +215,7 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
String useNumbersInOTP = StringUtils.EMPTY;
String otpLength = "6";
String enableSendNotificationOnCreation = "false";
String showUsernameUnavailability = "true";
String enableNotificationInternallyManage = "true";
String enableSelfRegistrationReCaptcha = "true";
String verificationCodeExpiryTime = "1440";
Expand Down Expand Up @@ -237,6 +243,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_OTP_LENGTH);
String sendNotificationOnCreationProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.SEND_CONFIRMATION_NOTIFICATION);
String showUsernameUnavailabilityProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.SHOW_USERNAME_UNAVAILABILITY);
String notificationInternallyMangedProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.SIGN_UP_NOTIFICATION_INTERNALLY_MANAGE);
String reCaptchaProperty = IdentityUtil.getProperty(
Expand Down Expand Up @@ -282,6 +290,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
if (StringUtils.isNotEmpty(sendNotificationOnCreationProperty)) {
enableSendNotificationOnCreation = sendNotificationOnCreationProperty;
}
if (StringUtils.isNotEmpty(showUsernameUnavailabilityProperty)) {
showUsernameUnavailability = showUsernameUnavailabilityProperty;
}
if (StringUtils.isNotEmpty(notificationInternallyMangedProperty)) {
enableNotificationInternallyManage = notificationInternallyMangedProperty;
}
Expand Down Expand Up @@ -329,6 +340,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
otpLength);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.SEND_CONFIRMATION_NOTIFICATION,
enableSendNotificationOnCreation);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.SHOW_USERNAME_UNAVAILABILITY,
showUsernameUnavailability);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.SIGN_UP_NOTIFICATION_INTERNALLY_MANAGE,
enableNotificationInternallyManage);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_RE_CAPTCHA,
Expand Down Expand Up @@ -399,6 +412,9 @@ public Map<String, Property> getMetaData() {
meta.put(IdentityRecoveryConstants.ConnectorConfig.SEND_CONFIRMATION_NOTIFICATION,
getPropertyObject(IdentityMgtConstants.DataTypes.BOOLEAN.getValue()));

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

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

Expand Down
Loading

0 comments on commit 031c49c

Please sign in to comment.