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 06bf59759b68..e678871b21f9 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 @@ -204,6 +204,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.AUTH_ENTITY; +import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.AUTH_ENTITY_AGENT; import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.AdaptiveAuthentication.AUTHENTICATOR_NAME_IN_AUTH_CONFIG; import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.Application.CONSOLE_APP; import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.Application.CONSOLE_APP_PATH; @@ -4282,6 +4284,11 @@ public static void validateUsername(String username, AuthenticationContext conte throws InvalidCredentialsException { if (IdentityUtil.isEmailUsernameEnabled()) { + if (context != null && context.getProperties() != null + && context.getProperties().containsKey(AUTH_ENTITY) + && AUTH_ENTITY_AGENT.equals(context.getProperty(AUTH_ENTITY))) { + return; + } String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username); if (StringUtils.countMatches(tenantAwareUsername, "@") < 1) { context.setProperty(CONTEXT_PROP_INVALID_EMAIL_USERNAME, true);