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

docs/examples/example_proxy2.php

Go to the documentation of this file.
00001 <?php
00002 
00003 //
00004 // phpCAS proxied proxy 
00005 //
00006 
00007 // import phpCAS lib
00008 include_once('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 // no SSL validation for the CAS server
00017 phpCAS::setNoCasServerValidation();
00018 
00019 // force CAS authentication
00020 phpCAS::forceAuthentication();
00021 
00022 // at this step, the user has been authenticated by the CAS server
00023 // and the user's login name can be read with phpCAS::getUser().
00024 
00025 // moreover, a PGT was retrieved from the CAS server that will
00026 // permit to gain accesses to new services.
00027 
00028 $service = 'http://phpcas-test.ifsic.univ-rennes1.fr/examples/example_service.php';
00029 
00030 ?>
00031 <html>
00032   <head>
00033     <title>phpCAS proxied proxy example</title>
00034   </head>
00035   <body>
00036     <h1>phpCAS proxied proxy example</h1>
00037     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00038     <h2>Response from service <?php echo $service; ?></h2><ul><hr>
00039 <?php
00040   flush();
00041   // call a service and change the color depending on the result
00042   if ( phpCAS::serviceWeb($service,$err_code,$output) ) {
00043     echo '<font color="#00FF00">';
00044   } else {
00045     echo '<font color="#FF0000">';
00046   }
00047   echo $output;
00048   echo '</font><hr></ul>';
00049 ?>
00050   </body>
00051 </html>
00052 

Generated on Sat Mar 26 2011 12:11:03 for phpCAS by  doxygen 1.7.1