Skip to content

Commit

Permalink
Add back the removed sms otp regex configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
shanggeeth committed Dec 6, 2023
1 parent 1b4be6a commit f367072
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public Map<String, String> getPropertyNameMapping() {
nameMapping
.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
"Lite user registration SMS OTP expiry time");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMS_OTP_REGEX,
"Lite user registration SMS OTP regex");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_CALLBACK_REGEX,
"Lite user registration callback URL regex");
nameMapping.put(LIST_PURPOSE_PROPERTY_KEY, "Manage Lite-Sign-Up purposes");
Expand Down Expand Up @@ -144,6 +146,10 @@ public Map<String, String> getPropertyDescriptionMapping() {
descriptionMapping.put(
IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
"Specify the expiry time in minutes for the SMS OTP.");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMS_OTP_REGEX,
"Regex for SMS OTP in format [allowed characters]{length}. Supported character " +
"ranges are a-z, A-Z, 0-9. Minimum OTP length is " +
IdentityMgtConstants.MINIMUM_SMS_OTP_LENGTH);
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_CALLBACK_REGEX,
"This prefix will be used to validate the callback URL.");
descriptionMapping.put(LIST_PURPOSE_PROPERTY_KEY, "Click here to manage Lite-Sign-Up purposes");
Expand All @@ -169,6 +175,7 @@ public String[] getPropertyNames() {
properties.add(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_VERIFICATION_CODE_EXPIRY_TIME);
properties
.add(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME);
properties.add(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMS_OTP_REGEX);
properties.add(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_CALLBACK_REGEX);
properties.add(LIST_PURPOSE_PROPERTY_KEY);
properties.add(
Expand All @@ -182,14 +189,15 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
String enableLiteSignUp = "false";
String enableAccountLockOnCreation = "true";
String enableSendOTPInEmail = "false";
String useUppercaseCharactersInOTP = "true";
String useLowercaseCharactersInOTP = "true";
String useNumbersInOTP = "true";
String useUppercaseCharactersInOTP = StringUtils.EMPTY;
String useLowercaseCharactersInOTP = StringUtils.EMPTY;
String useNumbersInOTP = StringUtils.EMPTY;
String otpLength = "6";
String enableNotificationInternallyManage = "true";
String enableLiteRegistrationReCaptcha = "true";
String verificationCodeExpiryTime = "1440";
String verificationSMSOTPExpiryTime = "1";
String verificationSMSOTPRegex = "[a-zA-Z0-9]{6}";
String liteRegistrationCallbackRegex = IdentityRecoveryConstants.DEFAULT_CALLBACK_REGEX;
String resendVerificationOnUserExistence = "false";

Expand All @@ -215,6 +223,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_VERIFICATION_CODE_EXPIRY_TIME);
String verificationSMSOTPExpiryTimeProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME);
String verificationSMSOTPRegexProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMS_OTP_REGEX);
String selfRegistrationCallbackRegexProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_CALLBACK_REGEX);
String selfRegistrationResendVerificationOnUserExistenceProperty = IdentityUtil.getProperty(
Expand Down Expand Up @@ -252,6 +262,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
if (StringUtils.isNotEmpty(verificationSMSOTPExpiryTimeProperty)) {
verificationSMSOTPExpiryTime = verificationSMSOTPExpiryTimeProperty;
}
if (StringUtils.isNotEmpty(verificationSMSOTPRegexProperty)) {
verificationSMSOTPRegex = verificationSMSOTPRegexProperty;
}
if (StringUtils.isNotEmpty(selfRegistrationCallbackRegexProperty)) {
liteRegistrationCallbackRegex = selfRegistrationCallbackRegexProperty;
}
Expand Down Expand Up @@ -283,6 +296,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
defaultProperties
.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
verificationSMSOTPExpiryTime);
defaultProperties
.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMS_OTP_REGEX,
verificationSMSOTPRegex);
defaultProperties.put(
IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_RESEND_VERIFICATION_ON_USER_EXISTENCE,
resendVerificationOnUserExistence);
Expand Down Expand Up @@ -345,6 +361,9 @@ public Map<String, Property> getMetaData() {
meta.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
getPropertyObject(IdentityMgtConstants.DataTypes.INTEGER.getValue()));

meta.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_SMS_OTP_REGEX,
getPropertyObject(IdentityMgtConstants.DataTypes.STRING.getValue()));

meta.put(LIST_PURPOSE_PROPERTY_KEY, getPropertyObject(IdentityMgtConstants.DataTypes.URI.getValue()));

meta.put(IdentityRecoveryConstants.ConnectorConfig.LITE_REGISTRATION_CALLBACK_REGEX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public Map<String, String> getPropertyNameMapping() {
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.EXPIRY_TIME, "Recovery link expiry time in minutes");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_EXPIRY_TIME,
"SMS OTP expiry time");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_REGEX, "SMS OTP regex");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_NOTIFICATION_SUCCESS,
"Notify when recovery success");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_SECURITY_START,
Expand Down Expand Up @@ -160,6 +161,9 @@ public Map<String, String> getPropertyDescriptionMapping() {
"Recovery callback URL regex");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_EXPIRY_TIME,
"Expiration time of the SMS OTP code for password recovery");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_REGEX, "Regex for "
+ "SMS OTP in format [allowed characters]{length}. Supported character ranges are a-z, A-Z, 0-9. " +
"Minimum OTP length is " + IdentityMgtConstants.MINIMUM_SMS_OTP_LENGTH);
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.ENABLE_AUTO_LGOIN_AFTER_PASSWORD_RESET,
"User will be logged in automatically after completing the Password Reset wizard");
return descriptionMapping;
Expand Down Expand Up @@ -189,6 +193,7 @@ public String[] getPropertyNames() {
properties.add(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_SECURITY_START);
properties.add(IdentityRecoveryConstants.ConnectorConfig.EXPIRY_TIME);
properties.add(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_EXPIRY_TIME);
properties.add(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_REGEX);
properties.add(IdentityRecoveryConstants.ConnectorConfig.FORCE_ADD_PW_RECOVERY_QUESTION);
properties.add(IdentityRecoveryConstants.ConnectorConfig.FORCE_MIN_NO_QUESTION_ANSWERED);
properties.add(IdentityRecoveryConstants.ConnectorConfig.RECOVERY_CALLBACK_REGEX);
Expand All @@ -203,9 +208,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG

String enableNotificationBasedPasswordRecovery = "false";
String enableSendOTPInEmail = "false";
String useUppercaseCharactersInOTP = "true";
String useLowercaseCharactersInOTP = "true";
String useNumbersInOTP = "true";
String useUppercaseCharactersInOTP = StringUtils.EMPTY;
String useLowercaseCharactersInOTP = StringUtils.EMPTY;
String useNumbersInOTP = StringUtils.EMPTY;
String otpLength = "6";
String enableQuestionBasedPasswordRecovery = "false";
String minimumAnswers = "2";
Expand All @@ -217,6 +222,7 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
String enableNotificationInternallyManage = "true";
String expiryTime = "1440";
String expiryTimeSMSOTP = "1";
String smsOtpRegex = "[a-zA-Z0-9]{6}";
String notifySuccess = "false";
String notifyStart = "false";
String enableForceChallengeQuestions = "false";
Expand Down Expand Up @@ -259,6 +265,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
String expiryTimeProperty = IdentityUtil.getProperty(IdentityRecoveryConstants.ConnectorConfig.EXPIRY_TIME);
String expiryTimeSMSOTPProperty = IdentityUtil
.getProperty(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_EXPIRY_TIME);
String smsOtpRegexProperty = IdentityUtil
.getProperty(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_REGEX);
String notifySuccessProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_NOTIFICATION_SUCCESS);
String notifyStartProperty = IdentityUtil.getProperty(
Expand All @@ -283,6 +291,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
if (StringUtils.isNotEmpty(expiryTimeSMSOTPProperty)) {
expiryTimeSMSOTP = expiryTimeSMSOTPProperty;
}
if (StringUtils.isNotEmpty(smsOtpRegexProperty)) {
smsOtpRegex = smsOtpRegexProperty;
}
if (StringUtils.isNotEmpty(notificationBasedPasswordRecovery)) {
enableNotificationBasedPasswordRecovery = notificationBasedPasswordRecovery;
}
Expand Down Expand Up @@ -396,6 +407,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.EXPIRY_TIME, expiryTime);
defaultProperties
.put(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_EXPIRY_TIME, expiryTimeSMSOTP);
defaultProperties
.put(IdentityRecoveryConstants.ConnectorConfig.PASSWORD_RECOVERY_SMS_OTP_REGEX, smsOtpRegex);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_NOTIFICATION_SUCCESS,
notifySuccess);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.NOTIFICATION_SEND_RECOVERY_SECURITY_START,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public Map<String, String> getPropertyNameMapping() {
"User self registration verification link expiry time");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
"User self registration SMS OTP expiry time");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMS_OTP_REGEX,
"User self registration SMS OTP regex");
nameMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_CALLBACK_REGEX,
"User self registration callback URL regex");
nameMapping.put(LIST_PURPOSE_PROPERTY_KEY, "Manage Self-Sign-Up purposes");
Expand Down Expand Up @@ -152,6 +154,10 @@ public Map<String, String> getPropertyDescriptionMapping() {
descriptionMapping.put(
IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
"Specify the expiry time in minutes for the SMS OTP.");
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMS_OTP_REGEX,
"Regex for SMS OTP in format [allowed characters]{length}. Supported character " +
"ranges are a-z, A-Z, 0-9. Minimum OTP length is " +
IdentityMgtConstants.MINIMUM_SMS_OTP_LENGTH);
descriptionMapping.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_CALLBACK_REGEX,
"This prefix will be used to validate the callback URL.");
descriptionMapping.put(LIST_PURPOSE_PROPERTY_KEY, "Click here to manage Self-Sign-Up purposes");
Expand Down Expand Up @@ -183,6 +189,7 @@ public String[] getPropertyNames() {
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_VERIFICATION_CODE_EXPIRY_TIME);
properties
.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMS_OTP_REGEX);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_CALLBACK_REGEX);
properties.add(LIST_PURPOSE_PROPERTY_KEY);
properties.add(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_NOTIFY_ACCOUNT_CONFIRMATION);
Expand All @@ -198,15 +205,16 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
String enableSelfSignUp = "false";
String enableAccountLockOnCreation = "true";
String enableSendOTPInEmail = "false";
String useUppercaseCharactersInOTP = "true";
String useLowercaseCharactersInOTP = "true";
String useNumbersInOTP = "true";
String useUppercaseCharactersInOTP = StringUtils.EMPTY;
String useLowercaseCharactersInOTP = StringUtils.EMPTY;
String useNumbersInOTP = StringUtils.EMPTY;
String otpLength = "6";
String enableSendNotificationOnCreation = "false";
String enableNotificationInternallyManage = "true";
String enableSelfRegistrationReCaptcha = "true";
String verificationCodeExpiryTime = "1440";
String verificationSMSOTPExpiryTime = "1";
String verificationSMSOTPRegex = "[a-zA-Z0-9]{6}";
String selfRegistrationCallbackRegex = IdentityRecoveryConstants.DEFAULT_CALLBACK_REGEX;
String enableSelfSignUpConfirmationNotification = "false";
String enableResendConfirmationRecaptcha = "false";
Expand Down Expand Up @@ -237,6 +245,8 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_VERIFICATION_CODE_EXPIRY_TIME);
String verificationSMSOTPExpiryTimeProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME);
String verificationSMSOTPRegexProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMS_OTP_REGEX);
String selfRegistrationCallbackRegexProperty = IdentityUtil.getProperty(
IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_CALLBACK_REGEX);
String selfSignUpConfirmationNotificationProperty = IdentityUtil.getProperty(
Expand Down Expand Up @@ -284,6 +294,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
if (StringUtils.isNotEmpty(verificationSMSOTPExpiryTimeProperty)) {
verificationSMSOTPExpiryTime = verificationSMSOTPExpiryTimeProperty;
}
if (StringUtils.isNotEmpty(verificationSMSOTPRegexProperty)) {
verificationSMSOTPRegex = verificationSMSOTPRegexProperty;
}
if (StringUtils.isNotEmpty(selfRegistrationCallbackRegexProperty)) {
selfRegistrationCallbackRegex = selfRegistrationCallbackRegexProperty;
}
Expand Down Expand Up @@ -326,6 +339,9 @@ public Properties getDefaultPropertyValues(String tenantDomain) throws IdentityG
defaultProperties
.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
verificationSMSOTPExpiryTime);
defaultProperties
.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMS_OTP_REGEX,
verificationSMSOTPRegex);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_AUTO_LOGIN,
enableSelfRegistrationAutoLogin);
defaultProperties.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_AUTO_LOGIN_ALIAS_NAME,
Expand Down Expand Up @@ -395,6 +411,9 @@ public Map<String, Property> getMetaData() {
meta.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMSOTP_VERIFICATION_CODE_EXPIRY_TIME,
getPropertyObject(IdentityMgtConstants.DataTypes.INTEGER.getValue()));

meta.put(IdentityRecoveryConstants.ConnectorConfig.SELF_REGISTRATION_SMS_OTP_REGEX,
getPropertyObject(IdentityMgtConstants.DataTypes.STRING.getValue()));

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

Expand Down
Loading

0 comments on commit f367072

Please sign in to comment.