You are here

function cas_test_validate in CAS 6.3

Same name and namespace in other branches
  1. 7 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 129
Dummy module implementing a CAS Server.

Code

function cas_test_validate() {

  // Prevent this page from being cached.
  global $conf;
  $conf['cache'] = FALSE;

  // Set content type.
  drupal_set_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;
}