Split the authenticate-method into several parts.