The default configurations of WSO2 products must have a single, embedded user store (primary user store). If required, you can configure WSO2 products to connect to several secondary user stores as well. After configuration, users from different stores can log in and perform operations depending on their roles/permissions. You can also configure your own customized user stores and connect them with the products as secondary stores.
You can either use the management console to create secondary user stores or you can create them manually. These will be stored as .xml files in the file system and you can use the same XML format that was used to configure primary user store.
The topics below explain how you can configure secondary user stores using management console or manually:
Before you begin:
If you are setting up a database other than the default H2 that comes with the product to store user information, select the script relevant to your database type from the <PRODUCT_HOME>/dbscripts
folder and run it on your database. It creates the necessary tables.
Configuring using the management console
Log in to the management console and click Add under the User Stores sub menu in the Main menu.
The Add New User Store page opens.You cannot update the PRIMARY user store at run time, so it is not visible on this page.
- From the User Store Manager Class drop down list, select the user store manager class that suite for your user store.
See User store manager section in Configuring User Stores for more information. If you have added a custom user store manger to the system that also availble in this dropdown menu. Enter a unique domain name with no underscore (_) characters, and optionally enter a description for this user store.
Enter values for the properties using the descriptions in the Descriptions column for guidance. The properties that appear vary based on the user store manager class you selected, and there may be additional properties in an Optional or Advanced section at the bottom of the screen.
In the following document you can find the information of the properties that you need to configure in user store manager types and It provides the additional steps and recommendations specific to each user store manager.
Configuring a JDBC User Store
Configuring a Read-Only LDAP User Store
Configuring a Read-Write Active Directory User Store
Configuring a Read-Write LDAP User Store
Ensure that all the mandatory fields are filled and a valid domain name is given and click Add.
It is important to read each user store configuration document to find specific information that you need to follow to configure particular user store.
A message like the appears saying that the user stores are being added.
The above message does not imply that the user store is added successfully. Rather it means that the server is attempting to add the new user store to the end of the available chain of user stores.
Refresh the page after a few seconds to check the status.
If the new user store is successfully added, it appears in the User Stores page. This can be viewed at any time by clicking List under User Stores in the Main menu.After adding to the server, you can edit the properties of the new secondary user store and enable/disable it in a dynamic manner.
<PRODUCT_HOME>/repository/deployment/server/userstores
directory for super tenant and <PRODUCT_HOME>/repository/tenants/<tenantid>/userstores
directory for tenant.Configuring manually
If you prefer to configure secondary user store manually, you can create this .xml file manually and save it as follows:
- When you configure multiple user stores, you must give a unique domain name to each user store in the <DomainName> element. If you configure a user store without specifying a domain name, the server throws an exception at start up.
- If it is the configuration of a super tenant, save the secondary user store definitions in
<PRODUCT_HOME>/repository/deployment/server/userstores
directory. - If it is a tenant, save the configuration in
<PRODUCT_HOME>/repository/tenants/<tenantid>/userstores
directory. - The the secondary user store configuration file must have the same name as the domain with an underscore (_) in place of the period. For example, if the domain is
wso2.com
, name the file aswso2_com.xml
. (Only one file contains the definition for one user store domain)
In the following user store manager configuration sections, you can find a sample configurations for each type of use store. Additionally you need to set the DomainName property with the domain name of your user store as follows:
<Property name="DomainName">Remote</Property>
In a clustered environment if we create a secondary user store from the UI, it will not sync between all the nodes by default. If you create a secondary user store after configuring the cluster these secondary user store configuration files need to copy manually to other nodes.