By default, PgBouncer is configured to maintain a file of all users that are allowed to connect. In a previous recipe, we even explain how to produce and maintain this file. However, as the amount of users increases, or, in the case where some part of the application creates users dynamically, this is highly inconvenient and potentially insecure.
Newer versions of PgBouncer improve this situation by implementing a new authentication procedure. This means we almost never need to manually update a list of users ever again. Not only does this mean we no longer maintain a list of usernames and encrypted passwords in a potentially insecure location, but we can use PostgreSQL itself to manage authentication through PgBouncer.
In this recipe, we will enable the new PgBouncer authentication system, and explore some of its other capabilities.
...