example_simple.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 // force CAS authentication
00016 phpCAS::forceAuthentication();
00017 
00018 // at this step, the user has been authenticated by the CAS server
00019 // and the user's login name can be read with phpCAS::getUser().
00020 
00021 // logout if desired
00022 if (isset($_REQUEST['logout'])) {
00023         phpCAS::logout();
00024 }
00025 
00026 // for this test, simply print that the authentication was successfull
00027 ?>
00028 <html>
00029   <head>
00030     <title>phpCAS simple client</title>
00031   </head>
00032   <body>
00033     <h1>Successfull Authentication!</h1>
00034     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00035     <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
00036     <p><a href="?logout=">Logout</a></p>
00037   </body>
00038 </html>

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