-
Notifications
You must be signed in to change notification settings - Fork 9
Home
saltybeagle edited this page Oct 28, 2011
·
1 revision
This is a simple example on using SimpleCAS to secure a page:
<?php
require_once 'SimpleCAS/Autoload.php';
require_once 'HTTP/Request2.php';
$options = array('hostname' => 'login.unl.edu',
'port' => 443,
'uri' => 'cas');
$protocol = new SimpleCAS_Protocol_Version2($options);
$client = SimpleCAS::client($protocol);
$client->forceAuthentication();
if (isset($_GET['logout'])) {
$client->logout();
}
if ($client->isAuthenticated()) {
echo '<h1>Authentication Successful!</h1>';
echo '<p>The user\'s login is '.$client->getUsername().'</p>';
}
?>
<a href="?logout">Logout</a>