function _cas_server_validate in CAS 7
Same name and namespace in other branches
- 5.4 cas_server.module \_cas_server_validate()
- 5.3 cas_server.module \_cas_server_validate()
- 6.3 cas_server.module \_cas_server_validate()
- 6.2 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 277 - 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' => $service,
':ticket' => $ticket,
);
$result = db_query_range("SELECT u.name FROM {cas_server_tickets} t JOIN {users} u ON t.uid=u.uid WHERE t.service = :service and t.ticket = :ticket AND valid=1", 0, 1, $ticket_info);
if ($result !== FALSE) {
foreach ($result as $ticket_data) {
$user_name = $ticket_data->name;
}
}
db_update('cas_server_tickets')
->fields(array(
'valid' => 0,
))
->condition('ticket', $ticket)
->execute();
return $user_name;
}