This documentation is for WSO2 Identity Server 5.3.0 . View documentation for the latest release.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 products can be configured to authenticate users using their attributes such as . For example, these attributes can be email or mobile number instead of the username. This If your organization decide to use users email as their 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 , since its used to differentiate username from tenant domain, in multi-tenant environments to build the user's fully-qualified name. For example, user daniel from user Daniel from the tenant domain has the fully-qualified name 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.


tenant domain separator. Do the following to configure this.


Configuring email as user in already running Identity Server is not the production recommended way.

  1. Open the <PRODUCT_HOME>/repository/conf/carbon.xml file.
  2. Look for the commented out configuration EnableEmailUserName. Uncomment the configuration to enable email authentication.

    Code Block
  3. Open the user<IS_HOME>/repository/conf/identity/identity-mgt.xml file found in the [PRODUCT_HOME]properties file and set the following property to true


    This step is required due to a known issue that prevents the confirmation codes from being removed after they are used when email usernames are enabled. This occurs because the '@' character (and some special characters) are not allowed in the registry. To overcome this issue, enable hashed usernames when saving the confirmation codes by configuring the properties below.

    Code Block

    Optionally, you can also configure the following property to determine which hash algorithm to use.

    Code Block
  4. Open the <PRODUCT_HOME>/repository/conf/ directory and configure the following. 


    user-mgt.xml file and add the following property under the relevant user store manager tag, such as ReadWriteLDAPUserStoreManager, ActiveDirectoryUserStoreManager or any other user store manager tag.
    This property determines the username validation that will be enforced when the EnableEmailUserName option is enabled. 


    Note: The user-mgt.xml file consists of configurations for the primary user store. If you are trying to configure this for a secondary user store, modify the relevant user store configuration file found in the [PRODUCT<PRODUCT_HOME]HOME>/repository/deployment/server/userstores directory instead.

    Code Block
    <Property name="UsernameWithEmailJavaScriptRegEx">^[\S]{3,30}$</Property>
  5. Configure the following set of parameters in the user -mgt.xml file under the relevant user store manager tagstore configuration, depending on the type of user store you are connected to (LDAP/Active Directory/JDBC).


    Note: These properties have not been added by default for the JDBCUserStoreManager. Therefore, if you are using a JDBC-based user store, you need to add the properties marked with an asterisk *, to the user-mgt.xml file under the relevant user store manager tag. For any other type of user store, simply modify the values of the properties listed below Some of these properties are specific to some types of user stores. Therefore check the description section of the properties to validate if they apply to your type of user store.

    If the UsernameWithEmailJavaScriptRegEx property has a regular expression with the "@" symbol, it is not required to configure UsernameJavaRegEx and UsernameJavaScriptRegEx properties. The priority order to configure username regular expression properties are as follows:

    1. UsernameJavaRegEx
    2. UsernameWithEmailJavaScriptRegEx

    For more information on these properties, click here.

    For this you need to set


    *  (This property is relevant to JDBCUserStoreManager) 

    Set the mail attribute of the user. LDAP/Active Directory only

    Code Block
    <Property name="UserNameAttribute">mail</Property>
    For this you need to use

    Use the mail attribute of the user instead of cn or uid. LDAP/Active Directory only

    Code Block
    <Property name="UserNameSearchFilter">(&amp;(objectClass=identityPerson)(mail=?))</Property>
    For this you need to use

    Use the mail attribute of the user. LDAP/Active Directory only

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

    This parameter is used to


    speed up the LDAP search operations. You can comment out this


    configuration. LDAP/Active Directory only

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

     (This property is relevant to JDBCUserStoreManager) 

    Change this property under the relevant user store manager tag as follows. This property allows you to add special characters like "@" in the user name.

    Code Block
    <Property name="UsernameJavaScriptRegEx">^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$</Property>

    This is a regular expression to validate usernames. By default, strings have a length of 5 to 30. Only non-empty characters are allowed. You can provide ranges of alphabets, numbers and also ranges of ASCII values in the RegEx properties.

    Code Block
    <Property name="UsernameJavaRegEx">a-zA-Z0-9@._-{3,30}$</Property>
    Realm configurations

    The AdminUser username


    must use the email attribute of the admin user.

    Code Block

    Before this configuration, the user having the username admin and password admin was considered the super administrator. The super administrator user cannot be deleted.

    After this configuration, the user having the username is considered the super administrator. The user having the username admin is considered as a normal administrator.

    Image Added


    If you changed the password of the admin user to something other than 'admin', start the WSO2 IS server using the -Dsetup parameter as seen in the command below.

    Code Block
    sh -Dsetup

    With these configuration users can login to super tenant with both email user name ( or non email user names (larry). But for tenant only email user names allowed (


    You can configure email user name without enabling EnableEmailUserName property, then users can login to both super tenant and tenant using email and non email user names. But super tenant users should always use @carbon.super at the end of user names.

  6. Restart the server.

titleRelated Topics

See Configuring User Stores for For more information on how to configure primary and secondary user stores, see Configuring User Stores.