quarkusio / registry.quarkus.io

Quarkus Extension Registry application
https://registry.quarkus.io
Apache License 2.0
10 stars 11 forks source link

Secure the database with separate users for admin and query operations #2

Open gastaldi opened 3 years ago

gastaldi commented 3 years ago

Query operations should be performed by a user that has little privilege on the database.

Admin operations should happen only on authenticated and authorized requests

gastaldi commented 3 years ago

Implementation idea: Create an @ApplicationScoped bean implementing io.agroal.api.AgroalPoolInterceptor. This will listen for connections coming out and in from the pool.

Then perform a SET SESSION AUTHORIZATION 'user' on the interceptor.

Link: https://www.postgresql.org/docs/current/sql-set-session-authorization.html