For how long postgres will keep alive connection after changing credentials?
A PostgreSQL instance will keep a client connection up and running until the connection either reaches a specified client timeout or the client (application) closes the connection. 

A change of password has no effects on existing connections and will only affect new connections.

There is no mechanism that constantly checks if the connection is still "password valid". A client connection is a one time authentication and if it was valid at the time of authentication will keep on being valid until closed.