You are here

function _simplesamlphp_auth_destroy_drupal_session in simpleSAMLphp Authentication 6.2

Same name and namespace in other branches
  1. 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_destroy_drupal_session()
  2. 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_destroy_drupal_session()
  3. 7 simplesamlphp_auth.module \_simplesamlphp_auth_destroy_drupal_session()
  4. 7.2 simplesamlphp_auth.module \_simplesamlphp_auth_destroy_drupal_session()

Helper function for logging out a user that is has a active session in Drupal but not with simpleSAML.

1 call to _simplesamlphp_auth_destroy_drupal_session()
simplesamlphp_auth_init in ./simplesamlphp_auth.module
Implementation of hook_init().

File

./simplesamlphp_auth.module, line 840
simpleSAMLphp authentication module for Drupal.

Code

function _simplesamlphp_auth_destroy_drupal_session() {
  global $user;
  watchdog('user', t('Session closed for %name.'), array(
    '%name' => $user->name,
  ));

  // Destroy the current session.
  session_destroy();

  // Only variables can be passed by reference workaround.
  $NULL = NULL;
  user_module_invoke('logout', $NULL, $user);

  // Load the anonymous user.
  $user = drupal_anonymous_user();
  drupal_goto();
}