I have a site with Single Sign On (SSO) implemented. The implementation of the features is complete and the site is running perfectly.
Now, I have a requirement where I am supposed to check whether the session of the central server (on root of the domain and not using Drupal) is alive. I can do this by checking the availability of the session cookie on the root domain. And if the session is not active the user is logged out of Drupal.
I tried implementing it inside hook_init() but it only works for non-cached pages, whereas I want my code to be triggered on every page.
I also had a look at hook_boot() which runs even on cached pages. But, it is called while Drupal is still in bootstrap mode; even before themes and modules are loaded into memory. Which would mean that I would not be able to check the status of the user (whether the user is logged in?), because the
user module and the included file
session.inc would not be present in the memory while the execution of this hook.
So my question is which function (or hook) should I use which would execute on all pages(cached and non-cached) and which would give me access to common
user properties (e.g.
global $user object,
user_is_logged_in() function etc)?