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 WSO2.com has the fully-qualified name [email protected]. 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.
- Open the carbon.xml file in the following path:
Look for the commented out configuration
EnableEmailUserName. Uncomment the configuration to enable email authentication.
identity-mgt.propertiesfile found in the
identity/directory and set the following property to true.
This step is required due to a known issue which 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.
user-mgt.xmlfile found in the
[PRODUCT_HOME]/repository/conf/directory and add the following property under the relevant user store manager tag. This property determines the username validation that will be enforced when the EnableEmailUserName option 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-mgt.xmlfile under the relevant user store manager tag, 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.xmlfile under the relevant user store manager tag. For any other type of user store, simply modify the values of the properties listed below.
* (This property is relevant to JDBCUserStoreManager)
For this you need to set mail attribute of the user.
For this you need to use the mail attribute of the user instead of cn or uid.
For this you need to use the mail attribute of the user.
This parameter is used to speedup the LDAP search operations. You can comment out this config.
*(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.
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 should use the email attribute of the admin user.