Factored the work of the authentication out of the view.