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

docs/examples/example_proxy_serviceWeb_chaining.php

Go to the documentation of this file.
00001 <?php
00002 // Example for a proxy with session usage
00003 
00004 // Load the settings from the central config file
00005 include_once('config.php');
00006 // Load the CAS lib
00007 include_once($phpcas_path.'/CAS.php');
00008 
00009 // Uncomment to enable debugging
00010 phpCAS::setDebug();
00011 
00012 // Initialize phpCAS
00013 phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
00014 
00015 // For production use set the CA certificate that is the issuer of the cert 
00016 // on the CAS server and uncomment the line below
00017 // phpCAS::setCasServerCACert($cas_server_ca_cert_path);
00018 
00019 // For quick testing you can disable SSL validation of the CAS server. 
00020 // THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION. 
00021 // VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL! 
00022 phpCAS::setNoCasServerValidation();
00023 
00024 // force CAS authentication
00025 phpCAS::forceAuthentication();
00026 
00027 // at this step, the user has been authenticated by the CAS server
00028 // and the user's login name can be read with phpCAS::getUser().
00029 
00030 // moreover, a PGT was retrieved from the CAS server that will
00031 // permit to gain accesses to new services.
00032 
00033 ?>
00034 <html>
00035   <head>
00036     <title>phpCAS proxy example #2</title>
00037     <link rel="stylesheet" type='text/css' href='example.css'/>
00038   </head>
00039   <body>
00040     <h1>phpCAS proxied proxy example</h1>
00041     <?php include 'script_info.php' ?>
00042     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00043     <h2>Response from service <?php echo $serviceUrl2; ?></h2>
00044 <?php
00045   flush();
00046   // call a service and change the color depending on the result
00047   if ( phpCAS::serviceWeb($serviceUrl2,$err_code,$output) ) {
00048     echo '<div class="success">';
00049   } else {
00050     echo '<div class="error">';
00051   }
00052   echo $output;
00053   echo '</div>';
00054 ?>
00055   </body>
00056 </html>
00057 

Generated on Sun Jun 5 2011 19:05:26 for phpCAS by  doxygen 1.7.1