function cas_server_service_validate in CAS 6.2
Same name and namespace in other branches
- 5.4 cas_server.module \cas_server_service_validate()
- 5.3 cas_server.module \cas_server_service_validate()
- 6.3 cas_server.module \cas_server_service_validate()
- 7 cas_server.module \cas_server_service_validate()
serviceValidate method using cas 2.0 Returns data in xml
1 string reference to 'cas_server_service_validate'
- cas_server_menu in ./
cas_server.module - Implementation of hook_menu
File
- ./
cas_server.module, line 112 - Provides a protocol compliant version of CAS server 2.x
Code
function cas_server_service_validate() {
$ticket = $_GET['ticket'];
$service = $_GET['service'];
$user_name = _cas_server_validate($service, $ticket);
if (!$user_name) {
$cas_error = 'INVALID_TICKET';
}
if (!$ticket || !$service) {
$cas_error = 'INVALID_REQUEST';
}
header('Content-type:', 'text/xml');
if ($user_name) {
//@TODO Generate proxy granting ticket
print "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>\n" . " <cas:authenticationSuccess>\n" . " <cas:user>{$user_name}</cas:user>\n" . " </cas:authenticationSuccess>\n" . "</cas:serviceResponse>\n";
watchdog('cas', 'User ' . $user_name . ' CAS sucessully authenticated.');
}
else {
print "<cas:serviceReponse xmlns:cas='http://www.yale.edu/tp/cas'>\n" . " <cas:authenticationFailure code=\"{$cas_error}\">\n" . " Ticket {$ticket} not recognized.\n" . " </cas:authenticationFailure>" . "</cas:serviceResponse>";
watchdog('cas', 'User ' . $user_name . ' authentication failed!');
}
}