example_gateway.php

00001 <?php
00002 
00003 //
00004 // phpCAS simple client
00005 //
00006 
00007 // import phpCAS lib
00008 include_once('CAS/CAS.php');
00009 
00010 phpCAS::setDebug();
00011 
00012 // initialize phpCAS
00013 phpCAS::client(CAS_VERSION_2_0,'sso-cas.univ-rennes1.fr',443,'');
00014 
00015 if (isset($_REQUEST['logout'])) {
00016   phpCAS::logout();
00017 }
00018 if (isset($_REQUEST['login'])) {
00019   phpCAS::forceAuthentication();
00020 }
00021 
00022 // check CAS authentication
00023 $auth = phpCAS::checkAuthentication();
00024 
00025 ?>
00026 <html>
00027   <head>
00028     <title>phpCAS simple client</title>
00029   </head>
00030   <body>
00031 <?php
00032 if ($auth) {
00033   // for this test, simply print that the authentication was successfull
00034 ?>
00035     <h1>Successfull Authentication!</h1>
00036     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00037     <p><a href="?logout=">Logout</a></p>
00038 <?php
00039 } else {
00040 ?>
00041     <h1>Guest mode</h1>
00042     <p><a href="?login=">Login</a></p>
00043 <?php
00044 }
00045 ?>
00046     <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
00047   </body>
00048 </html>

Generated on Wed Mar 14 14:55:56 2007 for phpCAS by  doxygen 1.5.0