Refactored to use single authenticateRequest method and pass username/password as headers