This commit is an attempt to improve the error message from failed
authentication attempts as well as attempting more usernames. Right now we only
attempt one username, but there are four different possible choices we could
select (including $USER which we weren't previously trying).
This commit tweaks a bunch of this logic and just in general refactors the
with_authentication function.
Closes #2399