4 * Example for overriding validation urls
8 * @file example_custom_urls.php
9 * @category Authentication
11 * @author Joachim Fritschi <jfritschi@freenet.de>
12 * @author Adam Franco <afranco@middlebury.edu>
13 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
14 * @link https://wiki.jasig.org/display/CASC/phpCAS
17 // Load the settings from the central config file
18 require_once 'config.php';
20 require_once $phpcas_path . '/CAS.php';
22 // Uncomment to enable debugging
26 phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
28 // For production use set the CA certificate that is the issuer of the cert
29 // on the CAS server and uncomment the line below
30 // phpCAS::setCasServerCACert($cas_server_ca_cert_path);
32 // For quick testing you can disable SSL validation of the CAS server.
33 // THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
34 // VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
35 phpCAS::setNoCasServerValidation();
37 // Override the validation url for any (ST and PT) CAS 2.0 validation
38 phpCAS::setServerProxyValidateURL('https://cas.example.org:1443/proxyValidate');
39 // Override the validation url for any CAS 1.0 validation
40 //phpCAS::setServerServiceValidateURL('https://cas.example.org:1443/serviceValidate');
41 //Override the validation url for any SAML11 validation
42 //phpCAS::setServerSamlValidateURL('https://cas.example.org:1443/samlValidate');
44 // force CAS authentication
45 phpCAS::forceAuthentication();
47 // at this step, the user has been authenticated by the CAS server
48 // and the user's login name can be read with phpCAS::getUser().
51 if (isset($_REQUEST['logout'])) {
55 // for this test, simply print that the authentication was successfull
59 <title>phpCAS simple client</title>
62 <h1>Successfull Authentication!</h1>
63 <?php require 'script_info.php' ?>
64 <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
65 <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
66 <p><a href="?logout=">Logout</a></p>