Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from kabel/master
Add gateway & renew features and increase abstraction
- Loading branch information
Showing
6 changed files
with
413 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
ini_set('display_errors', true); | ||
set_include_path(dirname(dirname(__DIR__)).'/src'.PATH_SEPARATOR.dirname(dirname(__DIR__)).'/vendor/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); | ||
|
||
$protocol->getRequest()->setConfig('ssl_verify_peer', false); | ||
|
||
$client = SimpleCAS::client($protocol); | ||
$client->gatewayAuthentication(); | ||
?> | ||
<?php if ($client->isAuthenticated()): ?> | ||
<?php if (isset($_GET['logout'])) { | ||
$client->logout(); | ||
} ?> | ||
<h1>Authentication Successful!</h1> | ||
<p>The user's login is <?php echo $client->getUsername() ?></p> | ||
<p>View the <a href="simple.php">authenticated home page</a></p> | ||
<a href="?logout">Logout</a> | ||
<?php else: ?> | ||
<h1>NOT Authenticated</h1> | ||
<p><a href="simple.php">Login</a> to see more</p> | ||
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
ini_set('display_errors', true); | ||
set_include_path(dirname(dirname(__DIR__)).'/src'.PATH_SEPARATOR.dirname(dirname(__DIR__)).'/vendor/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); | ||
|
||
$protocol->getRequest()->setConfig('ssl_verify_peer', false); | ||
|
||
$client = SimpleCAS::client($protocol); | ||
|
||
if (isset($_GET['logout'])) { | ||
$client->logout(); | ||
} | ||
|
||
$client->renewAuthentication(); | ||
|
||
if ($client->isAuthenticated()) { | ||
echo '<h1>Authentication Successful!</h1>'; | ||
echo '<p>Welcome to the renewed auth page.</p>'; | ||
} | ||
?> | ||
<a href="?logout">Logout</a> |
Oops, something went wrong.