This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

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 13 Next »

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 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 usernames. For this we need to configure the carbon.xml file.

  1. Open the carbon.xml file in the following path: [PRODUCT_HOME]/repository/conf/carbon.xml
  2. Look for the commented out configuration EnableEmailUserName. Uncomment the configuration to enable email authentication.

    <EnableEmailUserName>true</EnableEmailUserName>

The next configuration file you need to modify is the user-mgt.xml which can be found in the path: [PRODUCT_HOME]/repository/conf/user-mgt.xml

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 instead.

You may be connected to an LDAP or Active Directory or maybe to a JDBC-based user store. So regardless of the user store manager being used, focus on the following set of configuration parameters of the user store managers.

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 all the properties listed below.

ParameterDescription

UserNameAttribute

* (This property is relevant to JDBCUserStoreManager)

For this you need to set mail attribute of the user.

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

For this you need to use the mail attribute of the user instead of cn or uid.

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

For this you need to use the mail attribute of the user.

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

This parameter is used to speedup the LDAP search operations. You can comment out this config.

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

UsernameWithEmailJavaScriptRegEx

* (This property is relevant to JDBCUserStoreManager)

Add the following property under the relevant user store manager tag. This property enables you to add special characters like "@" in the user name.

<Property name="UsernameWithEmailJavaScriptRegEx">[a-zA-Z0-9@._-|//]{3,30}$</Property>
Realm configurations

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

<AdminUser>
         <UserName>admin@wso2.com</UserName>
         <Password>admin</Password>
</AdminUser>
Related Topics

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

  • No labels