When you try to connect to a PostgreSQL database, it searches pg_hba.conf using your connection method, username, and the name of the database you are connecting to, to decide whether or not to allow the connection, and whether to require a password or not.