Added authentication check and redirection. No actual authentication yet.