You are here

function cas_test_validate in CAS 7

Same name and namespace in other branches
  1. 6.3 tests/cas_test.module \cas_test_validate()

Validate a ticket using the CAS 1.x protocol.

1 string reference to 'cas_test_validate'
cas_test_menu in tests/cas_test.module
Implements hook_menu().

File

tests/cas_test.module, line 146
Dummy module implementing a CAS Server.

Code

function cas_test_validate() {

  // Prevent this page from being cached.
  drupal_page_is_cacheable(FALSE);

  // Set content type.
  drupal_add_http_header('Content-Type', 'text/plain; charset=utf-8');

  //Obtain the ticket from the url and validate it.
  $ticket = $_GET['ticket'];
  $service = $_GET['service'];
  $cas_user = _cas_test_ticket_validate($service, $ticket);
  if ($cas_user) {
    $cas_name = $cas_user['name'];
    print "yes\n";
    print "{$cas_name}\n";
  }
  else {
    print "no\n";
    print "\n";
  }
  exit;
}