Search code examples
wso2user-managementwso2-governance-registry

User Management Tables are not shared between WSO2 products


I have followed the this guide on sharing registry between WSO2 products using G-Reg. But the problem is that User Management Tables are not shared.

For example, I have created a new user "test" in G-Reg, but it is not valid in WSO2 ESB product (only native user "admin" is possible).

So is it possible to share users stored in G-Reg? Or are they stored in local H2 databases?


Solution

  • So is it possible to share users stored in G-Red? Or are they stored in local H2 databases?

    Yes, You can share users between all WSO2 products. By default, H2 used which is shipped with all the products.

    If you are going to share the user among multiple products, You need to go for a production ready databases like mysql, postgresql, etc.

    1. Create a database named userdb

    2. Add the below entry in repository/conf/datasources/master-datasources.xml

       <datasource>
       <name>WSO2_CARBON_USER</name>
       <description>The datasource used for registry and user manager</description>
       <jndiConfig>
          <name>jdbc/WSO2CarbonDB_User</name>
       </jndiConfig>
       <definition type="RDBMS">
          <configuration>
             <url>jdbc:mysql://localhost:3306/userdb</url>
             <username>wso2carbon</username>
             <password>wso2carbon</password>
             <driverClassName>com.mysql.jdbc.Driver</driverClassName>
             <maxActive>50</maxActive>
             <maxWait>60000</maxWait>
             <testOnBorrow>true</testOnBorrow>
             <validationQuery>SELECT 1</validationQuery>
             <validationInterval>30000</validationInterval>
          </configuration>
       </definition>
      

    3. Change the datasource JNDI name in repository/conf/user-mgt.xml file like following in both G-REG and ESB

      <Property name="dataSource">jdbc/WSO2CarbonDB_User</Property>
      
    4. Start the G-REG or ESB with -Dset up option to create the required database.This is required only in the first time.