Added the authentication check to the app controller.