You are here

function _cas_server_save_ticket in CAS 5.3

Same name and namespace in other branches
  1. 5.4 cas_server.module \_cas_server_save_ticket()
  2. 6.3 cas_server.module \_cas_server_save_ticket()
  3. 6.2 cas_server.module \_cas_server_save_ticket()
  4. 7 cas_server.module \_cas_server_save_ticket()

Generate a one time use login ticket for the user in question.

Parameters

int $uid:

1 call to _cas_server_save_ticket()
cas_server_service_return in ./cas_server.module

File

./cas_server.module, line 164
Provides a protocol compliant version of CAS server 2.x

Code

function _cas_server_save_ticket($uid, $service) {

  // Generate the ticket
  $time = time();
  $ticket = 'ST-' . user_password();
  $ticket_data = array(
    $uid,
    $service,
    $ticket,
    $time,
  );

  // Save the ticket to the db
  if ($uid && $service) {
    db_query("INSERT INTO {cas_server_tickets} (uid, service, ticket, timestamp) VALUES (%d, '%s', '%s', %d)", $ticket_data);
  }
  return $ticket;
}