Don’ts in JDBC Primary User Store

Never try this in WSO2 APIM 3.2.0

[Source: https://i.gifer.com/Bttr.gif]

Users and Systems: The never-ending bond

WSO2 APIM Primary User Store: On focus

[Source: https://miro.medium.com/max/700/1*Ez-ZnHQNuKk4e_fHMKQSwg.jpeg + edited]

Configure the JDBC Primary User store: The suffocation begins

[Source: https://static.wikia.nocookie.net/spongebob/images/e/e0/379.png/revision/latest?cb=20130327121057]

Step 1: Configure the Database

Approach: Default Approach
- WSO2AM_DB
- WSO2SHARED_DB

Step 2: Configure the primary user store

NOTE:
I have shared the complete deployment.toml that includes the database and user store configurations.
deployment.toml

Step 3: Change the primary user store domain name

[user_store.properties]
DomainName = "test"

Primary user store DomainName change: The real chaos

[Source: https://s3.amazonaws.com/lowres.cartoonstock.com/computers-desktop-computers-computer_problems-fires-computer_support-lfin581_low.jpg]
* ALL-USER-STORE-DOMAINS* TEST
Fig 1: Error message box in the carbon management console when listing the users
Fig 2: The error trace in the carbon log when listing the users with ALL-USER-STORE-DOMAINS filter where DomainName=”test”
Fig 3: Listing the users with the “TEST” domain name

What is the problem?

[Source: https://i.pinimg.com/originals/00/67/46/0067467e56db97e5ff2f6e2d3d8d161d.gif]

Unable to list the users in carbon management console with ALL-USER-STORE-DOMAINS filter

Fig 4: Error message box in the carbon management console when listing the users

Unable to log in to any of the portals after reverting the primary user store domain name to PRIMARY

Fig 5: Unable to log in to the system when the primary user store domain name is changed to PRIMARY

Solve the problem: Hands-on database

[Source: https://s3.amazonaws.com/lowres.cartoonstock.com/computers-computer_user-business_computer-nerds-computer_nerds-computer_geeks-tmcn188_low.jpg]
Case 1: The default PRIMARY domain name and the API details don't exist in the DB Case 2: The default PRIMARY domain exists and the API details don't exist in the DBCase 3: The default PRIMARY domain name and the API details exist in the DB
[user_store.properties]
DomainName = "test"

Case 1: The default PRIMARY domain name and the API details don’t exist in the DB

Database updates

case-1-db-table-update-queries.sql

Case 2: The default PRIMARY domain exists and the API details don't exist in the DB

Database updates

case-2-db-table-update-queries.sql

Case 3: The default PRIMARY domain name and the API details exist in the DB

1. Database updates

case-3-db-table-update-queries.sql
NOTE:
The following repository also consist DB scripts for the below mentioned DB setup. Please pick the relevant DB scripts according to your DB configuration.
Approach 2: Separated DB Approach
- WSO2AM_DB
- WSO2SHARED_DB
- WSO2REG_DB
- WSO2USER_DB

2. API Synapse Files

Fig 6: Filename appended with TEST domainName.
Fig 7: API synapse containing the TEST DomainName in the name attribute.
Fig 8: The appended TEST domain name has been removed
Fig 9: The appended TEST domain name has been removed

3. Solr re-indexing

[indexing]
re_indexing = 1

4. Carbon Management Console

Fig 10: The appended TEST domain name in the API provider name
Fig 11: The error message in the carbon console when the API provider and API owner has the prefix “TEST” in the carbon management console
Fig 12: Remove the appended TEST domain name from API provider and API owner
Fig 13: The appended TEST domain name has been removed

Recap!

[Source: https://media3.giphy.com/media/4SYbTUhaHCl3BQbnlr/giphy.gif]

References

Inquisitive

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store