• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • Examples
  • File List
  • File Members

docs/examples/example_gateway.php

Go to the documentation of this file.
00001 <?php
00002 
00003 //
00004 // phpCAS simple client
00005 //
00006 
00007 // import phpCAS lib
00008 include_once('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 // no SSL validation for the CAS server
00016 phpCAS::setNoCasServerValidation();
00017 
00018 if (isset($_REQUEST['logout'])) {
00019   phpCAS::logout();
00020 }
00021 if (isset($_REQUEST['login'])) {
00022   phpCAS::forceAuthentication();
00023 }
00024 
00025 // check CAS authentication
00026 $auth = phpCAS::checkAuthentication();
00027 
00028 ?>
00029 <html>
00030   <head>
00031     <title>phpCAS simple client</title>
00032   </head>
00033   <body>
00034 <?php
00035 if ($auth) {
00036   // for this test, simply print that the authentication was successfull
00037 ?>
00038     <h1>Successfull Authentication!</h1>
00039     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00040     <p><a href="?logout=">Logout</a></p>
00041 <?php
00042 } else {
00043 ?>
00044     <h1>Guest mode</h1>
00045     <p><a href="?login=">Login</a></p>
00046 <?php
00047 }
00048 ?>
00049     <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
00050   </body>
00051 </html>

Generated on Tue Aug 3 2010 08:38:39 for phpCAS by  doxygen 1.7.1