This documentation is for WSO2 Identity Server 5.0.0. View documentation for the latest release.
Email Authentication - Identity Server 5.0.0 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata

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 has the fully-qualified name 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.

  1. Open the carbon.xml file in the following path: [PRODUCT_HOME]/repository/conf/carbon.xml
  2. Look for the commented out configuration EnableEmailUserName. Uncomment the configuration to enable email authentication.


    Tip: When you do this configuration, the email becomes the admin username and you cannot configure your email address as an attribute in your user profile.

The next configuration file we need to modify is the user-mgt.xml which can be found in the path: [PRODUCT_HOME]/repository/conf/user-mgt.xml

You may be connected to an LDAP or Active Directory or maybe to a JDBC-based user store. So regardless of the user store manager being used, focus on the following set of configuration parameters of the user store managers.


Set the mail attribute of the user.

<Property name="UserNameAttribute">mail</Property>

Use the mail attribute of the user instead of cn or uid.

<Property name="UserNameSearchFilter">(&amp;(objectClass=identityPerson)(mail=?))</Property>

Use the mail attribute of the user in the user name filter list as well.

<Property name="UserNameListFilter">(&amp;(objectClass=identityPerson)(mail=*))</Property>

Use the following email regex.

<Property name="UsernameJavaRegEx">^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$</Property>

This parameter is used to speed up the LDAP search operations. You can comment out this config.

<!--Property name="UserDNPattern">cn={0},ou=Users,dc=wso2,dc=com</Property-->
Realm configurations

The AdminUser username should use the email attribute of the admin user.

  • No labels