issue #20555: Changed the way authentication is done

Couple of issues with the previous mechanism
1) created a new connection for every authentication
2) due to 1) unusable with pgbouncer