You are here

function simplesamlphp_auth_user_logout in simpleSAMLphp Authentication 7.3

Same name and namespace in other branches
  1. 8.3 simplesamlphp_auth.module \simplesamlphp_auth_user_logout()
  2. 7 simplesamlphp_auth.module \simplesamlphp_auth_user_logout()
  3. 7.2 simplesamlphp_auth.module \simplesamlphp_auth_user_logout()

Implements hook_user_logout().

File

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

Code

function simplesamlphp_auth_user_logout($account) {
  global $user;
  global $_simplesamlphp_auth_as;
  global $_simplesamlphp_auth_saml_attributes;
  global $base_url;
  _simplesaml_auth_autoload();
  if (!empty($_simplesamlphp_auth_saml_attributes)) {
    $config = SimpleSAML_Configuration::getInstance();

    // KLUDGE: for some reason Drupal is not killing the session, even if I
    // were to call drupal_session_destroy_uid() here.
    session_destroy();
    $gotourl = base_path();
    if (variable_get('simplesamlphp_auth_logoutgotourl', '')) {
      $gotourl = variable_get('simplesamlphp_auth_logoutgotourl', '');
    }

    // Allow modules to alter $gotourl.
    drupal_alter('simplesamlphp_auth_logout_gotourl', $gotourl, $account);
    $_simplesamlphp_auth_as
      ->logout($gotourl);
  }
}