Fix authenticating twice on same DB.

It is possible to authenticate against admin db to grant privileges
for another db. This fix will cover this case to avoid authenticating
twice.
Fix auth testing using localhost for setup.