example_session_service.php

00001 <?php
00002 
00003 //
00004 // phpCAS proxied client (service) with sessioning
00005 //
00006 
00007 // import phpCAS lib
00008 include_once('CAS/CAS.php');
00009 
00010 // set debug mode
00011 phpCAS::setDebug();
00012 
00013 // initialize phpCAS
00014 phpCAS::client(CAS_VERSION_2_0,'sso-cas.univ-rennes1.fr',443,'');
00015 
00016 // force CAS authentication
00017 phpCAS::forceAuthentication();
00018 
00019 // at this step, the user has been authenticated by the CAS server
00020 // and the user's login name can be read with phpCAS::getUser().
00021 
00022 // for this test, simply print that the authentication was successfull
00023 echo '<p>The user\'s login is <b>'.phpCAS::getUser().'</b>.</p>';
00024 
00025 // increment the number of requests of the session and print it
00026 echo '<p>request #'.(++$_SESSION['n']).'</p>';
00027 
00028 ?>

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