Basic auth rebase

Squashed previous commits and added a test, re: #143