Preparing for OAuth support, by making Basic Auth more generic