I am currently building a restful API (with Spring Boot) that accesses a database. This application will eventually be hosted on a server.
What I would like to do:
- Configure the database with multiple users, and assign them different rights to different tables
- Depending on which endpoint is called, use a specific user to execute that queries within that function
How do I go about configuring the application above?
The answers I've found so far involve configuring multiple datasources, but for the above application, there is only one datasource, but multiple users.
I have read the following link but am still trying to understand it
https://kimrudolph.de/blog/spring-datasource-routing
Do I configure multiple datasources all with the same URL (jdbcURL in this case), and multiple sets of usernames and passwords for each role?
Thank you!