You are here

function cas_server_validate in CAS 7

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.3 cas_server.module \cas_server_validate()
  4. 6.2 cas_server.module \cas_server_validate()

Validate the ticket using a CAS 1.x methodology This provides the simple non-xml based

1 string reference to 'cas_server_validate'
cas_server_menu in ./cas_server.module
Implementation of hook_menu

File

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

Code

function cas_server_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 = isset($_REQUEST['ticket']) ? $_REQUEST['ticket'] : '';
  $service = isset($_REQUEST['service']) ? $_REQUEST['service'] : '';

  // Check service against whitelist
  if (!_cas_server_check_service_whitelist($service)) {
    print "no\n";
    print "\n";
    return;
  }
  $user_name = _cas_server_validate($service, $ticket);
  if ($user_name) {
    print "yes\n";
    print "{$user_name}\n";
  }
  else {
    print "no\n";
    print "\n";
  }
}