You are here

function _cas_single_sign_out_save_token in CAS 7

Same name and namespace in other branches
  1. 5.4 cas.module \_cas_single_sign_out_save_token()
  2. 5.3 cas.module \_cas_single_sign_out_save_token()
  3. 6.3 cas.module \_cas_single_sign_out_save_token()
  4. 6.2 cas.module \_cas_single_sign_out_save_token()
1 call to _cas_single_sign_out_save_token()
cas_login_check in ./cas.module
Checks to see if the user needs to be logged in.

File

./cas.module, line 1177
Enables users to authenticate via a Central Authentication Service (CAS) Cas will currently work if the auto registration is turned on and will create user accounts automatically.

Code

function _cas_single_sign_out_save_token($user) {

  // Ok lets save the CAS service ticket to DB so
  // we can handle CAS logoutRequests when they come
  if ($user->uid && $user->uid > 0 && !empty($_SESSION['cas_ticket'])) {
    $hashed_ticket = hash('sha256', $_SESSION['cas_ticket']);
    db_merge('cas_login_data')
      ->key(array(
      'cas_session_id' => $hashed_ticket,
    ))
      ->fields(array(
      'cas_session_id' => $hashed_ticket,
      'uid' => $user->uid,
      'created' => time(),
    ))
      ->execute();
    unset($_SESSION['cas_ticket']);
  }
}