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

docs/examples/example_custom_urls.php

Go to the documentation of this file.
00001 <?php
00002 // Example for overriding validation urls
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::client(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 
00025 // Override the validation url for any (ST and PT) CAS 2.0 validation
00026 phpCAS::setServerProxyValidateURL('https://sso.hrz.tu-darmstadt.de:1443/proxyValidate');
00027 // Override the validation url for any CAS 1.0 validation
00028 //phpCAS::setServerServiceValidateURL('https://sso.hrz.tu-darmstadt.de:1443/serviceValidate');
00029 //Override the validation url for any SAML11 validation
00030 //phpCAS::setServerSamlValidateURL('https://sso.hrz.tu-darmstadt.de:1443/samlValidate');
00031 
00032 
00033 // force CAS authentication
00034 phpCAS::forceAuthentication();
00035 
00036 // at this step, the user has been authenticated by the CAS server
00037 // and the user's login name can be read with phpCAS::getUser().
00038 
00039 // logout if desired
00040 if (isset($_REQUEST['logout'])) {
00041         phpCAS::logout();
00042 }
00043 
00044 // for this test, simply print that the authentication was successfull
00045 ?>
00046 <html>
00047   <head>
00048     <title>phpCAS simple client</title>
00049   </head>
00050   <body>
00051     <h1>Successfull Authentication!</h1>
00052     <?php include 'script_info.php' ?>
00053     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00054     <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
00055     <p><a href="?logout=">Logout</a></p>
00056   </body>
00057 </html>

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