This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Using Email Address as the Username
WSO2 products can be configured to authenticate users using their attributes such as email or mobile number instead of the username. This topic provides instructions on how to set up your WSO2 product to authenticate a users by using their email.
The '@' is a special character in usernames of WSO2 products as it is used in multi-tenant environments to build the user's fully-qualified name. For example, user daniel from the tenant domain WSO2.com has the fully-qualified name daniel@WSO2.com. So before using the email username we need to configure the WSO2 products to differentiate between the '@' symbol in the user's emails and usernames. For this we need to configure the carbon.xml file.
Open the carbon.xml file in the following path:
[PRODUCT_HOME]/repository/conf/carbon.xmlLook for the commented out configuration
EnableEmailUserName. Uncomment the configuration to enable email authentication.<EnableEmailUserName>true</EnableEmailUserName>Open the
user-mgt.xmlfile found in the[PRODUCT_HOME]/repository/conf/directory and add the following property under the relevant user store manager tag. . This property determines the username validation that will be enforced when the EnableEmailUserName option is enabled.<Property name="UsernameWithEmailJavaScriptRegEx">^[\S]{3,30}$</Property>Configure the following set of parameters in the user-mgt.xml file under the relevant user store manager tag, depending on the type of user store you are connected to (LDAP/Active Directory/ JDBC).
Restart the server.
See Configuring User Stores for more information on how to configure primary and secondary user stores.