--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -83,6 +83,7 @@ function simplesamlphp_auth_permission() {
  * The /saml_login which triggers user authentication to SimpleSAMLphp SP.
  */
 function simplesamlphp_auth_loginpage() {
+  _simplesamlphp_auth_init();
   global $user;
   global $base_url;
   global $_simplesamlphp_auth_as;
@@ -179,9 +180,16 @@ function simplesamlphp_auth_loginpage() {
 }

 /**
- * Implements hook_init().
+ * Similar purpose to hook_init() only must be manually invoked.
  */
-function simplesamlphp_auth_init() {
+function _simplesamlphp_auth_init() {
+  // Ensure this function only executes once per page load.
+  static $gate = FALSE;
+  if ($gate) {
+    return;
+  }
+  $gate = TRUE;
+
   global $user;
   global $_simplesamlphp_auth_as;
   global $_simplesamlphp_auth_saml_attributes;
@@ -357,6 +365,7 @@ function simplesamlphp_auth_init() {
  * Implements hook_user_insert().
  */
 function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
+  _simplesamlphp_auth_init();
   global $_simplesamlphp_auth_as;
   global $_simplesamlphp_auth_saml_attributes;

@@ -414,6 +423,7 @@ function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
  * Implements hook_user_logout().
  */
 function simplesamlphp_auth_user_logout($account) {
+  _simplesamlphp_auth_init();
   global $user;
   global $_simplesamlphp_auth_as;
   global $_simplesamlphp_auth_saml_attributes;
@@ -493,6 +503,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
  * Implements hook_block_view().
  */
 function simplesamlphp_auth_block_view($delta = '') {
+  _simplesamlphp_auth_init();

   if (!_simplesamlphp_auth_isEnabled()) {
     // Exit without executing.
@@ -825,6 +836,7 @@ function _simplesamlphp_auth_destroy_drupal_session() {
  *   TRUE if the current user is authenticated through SAML.  FALSE otherwise.
  */
 function simplesamlphp_auth_is_authenticated() {
+  _simplesamlphp_auth_init();
   global $_simplesamlphp_auth_as;

   // Assume that the user isn't authenticated until proven otherwise.
