This documentation is for WSO2 Identity Server 5.4.0 . View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »


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

  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.

  3. Open the <IS_HOME>/repository/conf/claim-config.xml file and configure the AttributeID property of the claim ID that is under <Dialect dialectURI=""> to mail.


    This file is checked only when WSO2 IS is starting for the first time. Therefore, if you didn't configure this property at the time of starting up the server for the first time, you get errors at the start up.

  4. Open the <IS_HOME>/repository/conf/identity/ 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.


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

  5. Open the <PRODUCT_HOME>/repository/conf/user-mgt.xml file and add the porperty under the relevant user store manager tag, such as ReadWriteLDAPUserStoreManagerActiveDirectoryUserStoreManager or any other user store manager tag.

    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_HOME>/repository/deployment/server/userstores directory or from UI using UsernameWithEmailJavaScriptRegEx.

    <Property name="UsernameWithEmailJavaScriptRegEx">^[\S]{3,30}$</Property>
  6. 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).

    Note: Some of these properties are specific to some types of user stores. Therefore, check the description of each property 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 the username regular expression properties are as follows:

    1. UsernameJavaRegEx
    2. UsernameWithEmailJavaScriptRegEx

    For more information on these properties, click here.



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

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

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

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

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

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

    This parameter is used to speed up theLDAP search operations. You can comment out this config. LDAP/Active Directory only

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

    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.

    <Property name="UsernameJavaScriptRegEx">^[a-zA-Z0-9._-][email protected][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.

     UsernameJavaRegEx determines the username validation that will be enforced when the EnableEmailUserName option is enabled. Alternatively, you can set the UsernameJavaRegEx property from the UI.

    <Property name="UsernameJavaRegEx">[email protected]_-{3,30}$</Property>
    Realm configurations

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

             <UserName>[email protected]</UserName>

    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 [email protected] is considered the super administrator. The user having the username admin is considered as a normal administrator.

    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.

    sh -Dsetup

    With these configuration users can login to supper tenant with both email user name ([email protected]) or non email user names (alice). But for tenant only email user names allowed ([email protected]

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

Related Topics

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

  • No labels