Scenario:
Segmented application, with two or more parts, handling different aspects of access. Similar to how an OAuth situation would look. In the main application, I need to check if there's a valid session. If there is not a valid session, I want to re-direct to the authentication handling application. This could be the "internal" one (still a separate URL, etc) or an "external" one, like Google, Microsoft, whatever.
To avoid having to put a session check in every single Controller function or "route", is it a good idea to put a "global check" in
app/Config/Routes.php before anything else, and simply issue a re-direct (and die) before any routes are configured?
Or is there a better/more correct way of doing this the CodeIgniter way?
I guess I should also mention that if the "global session check" fails, the main application should obviously check if we're coming back from an authentication handling app with the correct parameters.
I just realized I could possibly use the Controller's before filter, I think? :-) But then I'd need to add one for every controller, so it's still not a "global session check" per se.
Or is it a $global Filter I should actually use ... ?
-joho