Refactor our authentication and authentication testing code.