diff --git a/.changeset/spicy-bottles-obey.md b/.changeset/spicy-bottles-obey.md new file mode 100644 index 00000000000..330fa269f3d --- /dev/null +++ b/.changeset/spicy-bottles-obey.md @@ -0,0 +1,9 @@ +--- +"@wso2is/admin.validation.v1": minor +"@wso2is/admin.core.v1": minor +"@wso2is/console": minor +"@wso2is/core": patch +"@wso2is/i18n": patch +--- + +Add the passwordMaxAllowed length config for password length values validation. diff --git a/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 b/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 index 13b27acb6f5..6d8b9dfbeac 100644 --- a/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 +++ b/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 @@ -1844,6 +1844,17 @@ {% else %} "isPasswordInputValidationEnabled": true, {% endif %} + "passwordPolicyConfigs": { + {% if identity_mgt.password_policy.items() is defined %} + {% for key, value in identity_mgt.password_policy.items() %} + {% if value is string %} + "{{ key }}": "{{ value }}"{{ "," if not loop.last }} + {% else %} + "{{ key }}": {{ value }}{{ "," if not loop.last }} + {% endif %} + {% endfor %} + {% endif %} + }, "isSignatureValidationCertificateAliasEnabled": {{ console.applications.ui.certificate_alias_enabled }}, "listAllAttributeDialects": {{ console.list_all_attribute_dialects }}, {% if console.enable_identity_claims is defined %} diff --git a/apps/console/src/public/deployment.config.json b/apps/console/src/public/deployment.config.json index acd2d775443..defde180299 100644 --- a/apps/console/src/public/deployment.config.json +++ b/apps/console/src/public/deployment.config.json @@ -1260,6 +1260,9 @@ "roleMapping": false }, "listAllAttributeDialects": true, + "passwordPolicyConfigs": { + "maxPasswordAllowedLength": 64 + }, "privacyPolicyConfigs": {}, "productName": "WSO2 Identity Server", "productVersionConfig": { diff --git a/features/admin.core.v1/configs/app.ts b/features/admin.core.v1/configs/app.ts index 34a79f873b5..a00f234a38e 100644 --- a/features/admin.core.v1/configs/app.ts +++ b/features/admin.core.v1/configs/app.ts @@ -343,6 +343,7 @@ export class Config { isXacmlConnectorEnabled: window[ "AppUtils" ]?.getConfig()?.ui?.isXacmlConnectorEnabled, legacyMode: window[ "AppUtils" ]?.getConfig()?.ui?.legacyMode, listAllAttributeDialects: window[ "AppUtils" ]?.getConfig()?.ui?.listAllAttributeDialects, + passwordPolicyConfigs: window[ "AppUtils" ]?.getConfig()?.ui?.passwordPolicyConfigs, privacyPolicyConfigs: window[ "AppUtils" ]?.getConfig()?.ui?.privacyPolicyConfigs, productName: window[ "AppUtils" ]?.getConfig()?.ui?.productName, productVersionConfig: window[ "AppUtils" ]?.getConfig()?.ui?.productVersionConfig, diff --git a/features/admin.core.v1/models/config.ts b/features/admin.core.v1/models/config.ts index 37e72d8eef3..162bb0df9f4 100644 --- a/features/admin.core.v1/models/config.ts +++ b/features/admin.core.v1/models/config.ts @@ -482,6 +482,20 @@ export interface UIConfigInterface extends CommonUIConfigInterface state?.config?.ui?.features); + const maxPasswordLengthLimit: number = useSelector((state: AppState) => + state?.config?.ui?.passwordPolicyConfigs?.maxPasswordAllowedLength); + const maxPasswordLengthLimitLength: number = maxPasswordLengthLimit.toString().length; const [ isSubmitting, setSubmitting ] = useState(false); const [ initialFormValues, setInitialFormValues ] = useState< @@ -509,11 +512,10 @@ export const ValidationConfigEditPage: FunctionComponent - ValidationConfigConstants.VALIDATION_CONFIGURATION_FORM_FIELD_CONSTRAINTS.PASSWORD_MAX_VALUE) { + } else if (Number(values.maxLength) > maxPasswordLengthLimit) { error = true; description = t( - "validation:validationError.maxLimitError" + "validation:validationError.maxLimitError", { maxPasswordValue: maxPasswordLengthLimit } ); } else if (Number(values.minLength) > Number(values.maxLength)) { error = true; @@ -741,9 +743,7 @@ export const ValidationConfigEditPage: FunctionComponent max) { return t("common:maxValidation", { max }); @@ -757,9 +757,7 @@ export const ValidationConfigEditPage: FunctionComponent