Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages | Examples

example_file.php

<?php // // phpCAS proxy client with PGT storage to file // // import phpCAS lib include_once('CAS/CAS.php'); phpCAS::setDebug(); // initialize phpCAS phpCAS::proxy(CAS_VERSION_2_0,'sso-cas.univ-rennes1.fr',443,''); // set PGT storage to file in XML format in the same directory as session files phpCAS::setPGTStorageFile('xml',session_save_path()); // force CAS authentication phpCAS::forceAuthentication(); // at this step, the user has been authenticated by the CAS server // and the user's login name can be read with phpCAS::getUser(). // moreover, a PGT was retrieved from the CAS server that will // permit to gain accesses to new services. $service = 'https://cas.ifsic.univ-rennes1.fr/examples/example_service.php'; ?> <html> <head> <title>phpCAS proxy example with PGT storage to file</title> </head> <body> <h1>phpCAS proxy example with PGT storage to file</h1> <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p> <h2>Response from service <?php echo $service; ?></h2><ul><hr> <?php flush(); // call a service and change the color depending on the result if ( phpCAS::serviceWeb($service,$err_code,$output) ) { echo '<font color="#00FF00">'; } else { echo '<font color="#FF0000">'; } echo $output; echo '</font><hr></ul>'; ?> </body> </html>
00001 <?php 00002 00003 // 00004 // phpCAS proxy client with PGT storage to file 00005 // 00006 00007 // import phpCAS lib 00008 include_once('CAS/CAS.php'); 00009 00010 phpCAS::setDebug(); 00011 00012 // initialize phpCAS 00013 phpCAS::proxy(CAS_VERSION_2_0,'sso-cas.univ-rennes1.fr',443,''); 00014 00015 // set PGT storage to file in XML format in the same directory as session files 00016 phpCAS::setPGTStorageFile('xml',session_save_path()); 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 // moreover, a PGT was retrieved from the CAS server that will 00025 // permit to gain accesses to new services. 00026 00027 $service = 'https://cas.ifsic.univ-rennes1.fr/examples/example_service.php'; 00028 00029 ?> 00030 <html> 00031 <head> 00032 <title>phpCAS proxy example with PGT storage to file</title> 00033 </head> 00034 <body> 00035 <h1>phpCAS proxy example with PGT storage to file</h1> 00036 <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p> 00037 <h2>Response from service <?php echo $service; ?></h2><ul><hr> 00038 <?php 00039 flush(); 00040 // call a service and change the color depending on the result 00041 if ( phpCAS::serviceWeb($service,$err_code,$output) ) { 00042 echo '<font color="#00FF00">'; 00043 } else { 00044 echo '<font color="#FF0000">'; 00045 } 00046 echo $output; 00047 echo '</font><hr></ul>'; 00048 ?> 00049 </body> 00050 </html>

Generated on Thu Aug 17 02:03:20 2006 for phpCAS by doxygen 1.3.7