Custom authentication support

This PR adds support of custom authentication mechanisms. Also, added ability to disable automatic connection, because it is required for setting custom authentication.