diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/provisioning/impl/DefaultProvisioningHandler.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/provisioning/impl/DefaultProvisioningHandler.java index b2578279d5c0..b77a1ae22cf3 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/provisioning/impl/DefaultProvisioningHandler.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/handler/provisioning/impl/DefaultProvisioningHandler.java @@ -306,7 +306,9 @@ tobeDeleted claims (claims came from federated idp as null). If there is a match need to write a provisioning handler extending the "DefaultProvisioningHandler". */ UserCoreUtil.setSkipPasswordPatternValidationThreadLocal(true); - UserCoreUtil.setSkipUsernamePatternValidationThreadLocal(true); + if (FrameworkUtils.isSkipUsernamePatternValidation()) { + UserCoreUtil.setSkipUsernamePatternValidationThreadLocal(true); + } if (FrameworkUtils.isJITProvisionEnhancedFeatureEnabled()) { setJitProvisionedSource(tenantDomain, idp, userClaims); } diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java index cdc4d44f8f7f..71eb1f62aa5c 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java @@ -2663,6 +2663,18 @@ public static String getUserNameProvisioningUIUrl() { return userNamePrvisioningUrl; } + /** + * To get the username provisioning url from the configuration file. + * + * @return relevant username provisioning url. + */ + public static boolean isSkipUsernamePatternValidation() { + + return Boolean.parseBoolean( + IdentityUtil.getProperty("JITProvisioning.SkipUsernamePatternValidation")); + } + + /** * This method is to provide flag about Adaptive authentication is availability. * diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 index 31152195ea75..160c44aabfee 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 @@ -1766,6 +1766,7 @@ {{authentication.jit_provisioning.username_provisioning_url}} {{authentication.jit_provisioning.password_provisioning_url}} + {{authentication.jit_provisioning.skip_username_pattern_validation}} {{authentication.jit_provisioning.enable_enhanced_feature}} diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json index 6c9c998de01b..d345073717be 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json @@ -497,6 +497,7 @@ "authentication_policy.check_account_exist": true, "authentication.jit_provisioning.username_provisioning_url": "/accountrecoveryendpoint/register.do", "authentication.jit_provisioning.password_provisioning_url": "/accountrecoveryendpoint/signup.do", + "authentication.jit_provisioning.skip_username_pattern_validation": false, "authentication.jit_provisioning.enable_enhanced_feature": false, "application_mgt.enable_role_validation": false,