phpCAS  version 1.4.0
example_custom_urls.php
Go to the documentation of this file.
1 <?php
2 
17 // Load the settings from the central config file
18 require_once 'config.php';
19 // Load the CAS lib
20 require_once $phpcas_path . '/CAS.php';
21 
22 // Enable debugging
24 // Enable verbose error messages. Disable in production!
25 phpCAS::setVerbose(true);
26 
27 // Initialize phpCAS
29 
30 // For production use set the CA certificate that is the issuer of the cert
31 // on the CAS server and uncomment the line below
32 // phpCAS::setCasServerCACert($cas_server_ca_cert_path);
33 
34 // For quick testing you can disable SSL validation of the CAS server.
35 // THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
36 // VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
38 
39 // Override the proxy validation url for any (ST and PT) any CAS 1.0, 2.0 and 3.0 validation
40 // Example of the URL for the version of CAS 2.0 validation
41 phpCAS::setServerProxyValidateURL('https://cas.example.org:1443/proxyValidate');
42 // Override the validation url for any CAS 1.0, 2.0 and 3.0 validation
43 // Example of the URL for the version of CAS 2.0 validation
44 //phpCAS::setServerServiceValidateURL('https://cas.example.org:1443/serviceValidate');
45 //Override the validation url for any SAML11 validation
46 //phpCAS::setServerSamlValidateURL('https://cas.example.org:1443/samlValidate');
47 
48 // force CAS authentication
50 
51 // at this step, the user has been authenticated by the CAS server
52 // and the user's login name can be read with phpCAS::getUser().
53 
54 // logout if desired
55 if (isset($_REQUEST['logout'])) {
57 }
58 
59 // for this test, simply print that the authentication was successfull
60 ?>
61 <html>
62  <head>
63  <title>phpCAS simple client</title>
64  </head>
65  <body>
66  <h1>Successfull Authentication!</h1>
67  <?php require 'script_info.php' ?>
68  <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
69  <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
70  <p><a href="?logout=">Logout</a></p>
71  </body>
72 </html>
static forceAuthentication()
Definition: CAS.php:1146
Definition: CAS.php:281
static client($server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true, \SessionHandlerInterface $sessionHandler=null)
Definition: CAS.php:345
$phpcas_path
static setLogger($logger=null)
Definition: CAS.php:448
const CAS_VERSION_2_0
Definition: CAS.php:78
static setServerProxyValidateURL($url='')
Definition: CAS.php:1403
static logout($params="")
Definition: CAS.php:1480
static setVerbose($verbose)
Definition: CAS.php:512
$cas_host
$cas_context
$cas_port
static setNoCasServerValidation()
Definition: CAS.php:1689