WSO2 products can be configured to authenticate users using their attributes. For example, these attributes can be email or mobile number instead of the username. 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 users using their email.
'@' is a special character in WSO2 products, since its used to differentiate username from tenant domain, in multi-tenant environments. 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 tenant domain separator. Do the following to configure this.
Configuring email as user in already running Identity Server is not the production recommended way.
- Open the <
Look for the commented out configuration
EnableEmailUserName. Uncomment the configuration to enable email authentication.
identity/file and set the following property to
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.
Open the <
PRODUCT_HOME>/repository/conf/user-mgt.xmlfile and add the following property under the relevant user store manager tag, such as
ActiveDirectoryUserStoreManageror any other user store manager tag.
This property determines the username validation that will be enforced when the
EnableEmailUserNameoption is enabled.
user-mgt.xmlfile 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
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 section of the properties to validate if they apply to your type of user store.
For more information on these properties, click here.
Set the mail attribute of the user. LDAP/Active Directory only
Use the mail attribute of the user instead of
uid. LDAP/Active Directory only
Use the mail attribute of the user. LDAP/Active Directory only
This parameter is used to speed up the LDAP search operations. You can comment out this configuration. LDAP/Active Directory only
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.
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.
AdminUserusername must use the email attribute of the admin user.
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
firstname.lastname@example.org 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.
With these configuration users can login to super tenant with both email user name (email@example.com) or non email user names (alice). But for tenant only email user names allowed (firstname.lastname@example.org@wso2.com)
You can configure email user name without enabling
EnableEmailUserNameproperty, 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.
Restart the server.