bnoguchi/everyauth — Issue #152: auto-routing of non-logged in users to /login for set of routes
Author: blaenk
Created: 2012-01-09 03:01:58+00:00
State: open

This module seems to be working just fine so far thanks :)

I just wanted to ask if there was a built-in way to handle the redirection of non-logged in visitors to the `/login` page for a set of predefined routes. For example, in the Ruby on Rails [Devise](https://github.com/plataformatec/devise) gem, one can specify certain controllers to have a `before_filter :authenticate_user!`, this makes sure the user is logged in and if not it redirects them to the login page.

I was thinking of creating a function that did this manually by checking `req.loggedIn`, issuing a redirect based on that, and then calling this function manually for each route I want to be authenticated. But I was wondering if there was already a built-in way to do this or otherwise an accepted way of doing it. If not, perhaps this hypothetical function I would create would serve better as middleware.

Thanks!