Skip to content

Using Email Address as the Username


Configuring the email address as the username in an already running Identity Server is not the production recommended way. Therefore, make sure to configure it before you begin working with WSO2 IS.

  1. Open the <IS_HOME>/repository/conf/deployment.toml file.
  2. Add the followign configuration.

    enable_email_domain= true
  3. Login to the management console and configure the Mapped Attribute property of the claim ID that is under Dialect dialectURI to mail.

  4. Configure the following set of parameters in the user store configuration, depending on the type of user store you are connected to (LDAP/Active Directory/ JDBC).

    Parameter Description


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


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

     In LDAP,[user_store] 

    In Active Directory, [user_store]
    user_name_search_filter = "(&amp;(objectClass=user)(mail=?))"

    Use the mail attribute of the user if necessary. LDAP/Active Directory only
    For example:



    you are trying with the default embedded LDAP user store, this configuration change is not needed.


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

    username_java_script_regex = '^[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$'

    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.

    Realm configurations

    The username must use the email attribute of the admin user.

    username = ""
    password = "admin"


    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.


    With these configuration users can log in to super tenant with both email user name ( ) or non-email user names (alice). But for tenant only email user names allowed (tod@ @ )


    You can configure email user name without enabling enable_email_domain 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.

  5. Restart the server.

Related Topics

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