You are here

function _cas_server_validate in CAS 6.3

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

Test to see if a one time use ticket is valid

Parameters

unknown_type $ticket:

Return value

unknown

2 calls to _cas_server_validate()
cas_server_service_validate in ./cas_server.module
serviceValidate method using cas 2.0 Returns data in xml
cas_server_validate in ./cas_server.module
Validate the ticket using a CAS 1.x methodology This provides the simple non-xml based

File

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

Code

function _cas_server_validate($service, $ticket) {

  // Look up the ticket
  $user_name = '';
  $ticket_info = array(
    $service,
    $ticket,
  );
  $result = db_query_range("SELECT u.name FROM {cas_server_tickets} t JOIN {users} u ON t.uid=u.uid  WHERE t.service = '%s' and t.ticket = '%s' AND valid=1", $ticket_info, 0, 1);
  if ($result !== FALSE) {
    while ($ticket_data = db_fetch_object($result)) {
      $user_name = $ticket_data->name;
    }
  }
  db_query("UPDATE {cas_server_tickets} SET valid=0 WHERE ticket='%s'", array(
    $ticket,
  ));
  return $user_name;
}