Move the authentication code into a separate class.
Add new HttpRequest and HttpResponse API.