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

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

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