example_session_proxy.php

00001 <?php
00002 
00003 //
00004 // phpCAS proxied proxy 
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::proxy(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 // moreover, a PGT was retrieved from the CAS server that will
00023 // permit to gain accesses to new services.
00024 
00025 $service = 'http://phpcas-test.ifsic.univ-rennes1.fr/examples/example_session_service.php';
00026 
00027 ?>
00028 <html>
00029   <head>
00030     <title>phpCAS proxied proxy example (with sessioning)</title>
00031   </head>
00032   <body>
00033     <h1>phpCAS proxied proxy example (with sessioning)</h1>
00034     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00035     <h2>Response from service <?php echo $service; ?></h2><ul><hr>
00036 <?php
00037   flush();
00038   // call a service and change the color depending on the result
00039   if ( phpCAS::serviceWeb($service,$err_code,$output) ) {
00040     echo '<font color="#00FF00">';
00041   } else {
00042     echo '<font color="#FF0000">';
00043   }
00044   echo $output;
00045   echo '</font><hr></ul>';
00046 ?>
00047   </body>
00048 </html>
00049 

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