You are here

function simplesamlphp_auth_user_logout in simpleSAMLphp Authentication 7

Same name and namespace in other branches
  1. 8.3 simplesamlphp_auth.module \simplesamlphp_auth_user_logout()
  2. 7.3 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 336
simpleSAMLphp authentication module for Drupal.

Code

function simplesamlphp_auth_user_logout($account) {
  global $user;
  global $_simplesamlphp_auth_as;
  global $_simplesamlphp_auth_saml_attributes;
  if (!empty($_simplesamlphp_auth_saml_attributes)) {
    $config = SimpleSAML_Configuration::getInstance();
    $msg = 'with_slo';
    try {
      $slo = $config
        ->getString('SingleLogoutService');
    } catch (Exception $e) {
      $msg = "no_slo";
    }

    // :KLUDGE: for some reason Drupal is not killing the session, even if I were to call drupal_session_destroy_uid() here.
    session_destroy();
    $_simplesamlphp_auth_as
      ->logout('/?msg=' . $msg);
  }
}