Upgrade phpCAS
[piwik-CASLogin.git] / CAS / docs / examples / config.example.php
1 <?php
2
3 /**
4  * The purpose of this central config file is configuring all examples
5  * in one place with minimal work for your working environment
6  * Just configure all the items in this config according to your environment
7  * and rename the file to config.php
8  *
9  * PHP Version 5
10  *
11  * @file     config.php
12  * @category Authentication
13  * @package  PhpCAS
14  * @author   Joachim Fritschi <jfritschi@freenet.de>
15  * @author   Adam Franco <afranco@middlebury.edu>
16  * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
17  * @link     https://wiki.jasig.org/display/CASC/phpCAS
18  */
19
20 $phpcas_path = '../../source/';
21
22 ///////////////////////////////////////
23 // Basic Config of the phpCAS client //
24 ///////////////////////////////////////
25
26 // Full Hostname of your CAS Server
27 $cas_host = 'cas.example.com';
28
29 // Context of the CAS Server
30 $cas_context = '/cas';
31
32 // Port of your CAS server. Normally for a https server it's 443
33 $cas_port = 443;
34
35 // Path to the ca chain that issued the cas server certificate
36 $cas_server_ca_cert_path = '/path/to/cachain.pem';
37
38 //////////////////////////////////////////
39 // Advanced Config for special purposes //
40 //////////////////////////////////////////
41
42 // The "real" hosts of clustered cas server that send SAML logout messages
43 // Assumes the cas server is load balanced across multiple hosts
44 $cas_real_hosts = array('cas-real-1.example.com', 'cas-real-2.example.com');
45
46 // Database config for PGT Storage
47 $db = 'pgsql:host=localhost;dbname=phpcas';
48 //$db = 'mysql:host=localhost;dbname=phpcas';
49 $db_user = 'phpcasuser';
50 $db_password = 'mysupersecretpass';
51 $db_table = 'phpcastabel';
52 $driver_options = '';
53
54 ///////////////////////////////////////////
55 // End Configuration -- Don't edit below //
56 ///////////////////////////////////////////
57
58 // Generating the URLS for the local cas example services for proxy testing
59 if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
60     $curbase = 'https://' . $_SERVER['SERVER_NAME'];
61 } else {
62     $curbase = 'http://' . $_SERVER['SERVER_NAME'];
63 }
64 if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
65     $curbase .= ':' . $_SERVER['SERVER_PORT'];
66 }
67
68 $curdir = dirname($_SERVER['REQUEST_URI']) . "/";
69
70 // CAS client nodes for rebroadcasting pgtIou/pgtId and logoutRequest
71 $rebroadcast_node_1 = 'http://cas-client-1.example.com';
72 $rebroadcast_node_2 = 'http://cas-client-2.example.com';
73
74 // access to a single service
75 $serviceUrl = $curbase . $curdir . 'example_service.php';
76 // access to a second service
77 $serviceUrl2 = $curbase . $curdir . 'example_service_that_proxies.php';
78
79 $pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase . $curdir), '/');
80 $pgtUrlRegexp = '/^' . $pgtBase . '.*$/';
81
82 $cas_url = 'https://' . $cas_host;
83 if ($cas_port != '443') {
84     $cas_url = $cas_url . ':' . $cas_port;
85 }
86 $cas_url = $cas_url . $cas_context;
87
88 // Set the session-name to be unique to the current script so that the client script
89 // doesn't share its session with a proxied script.
90 // This is just useful when running the example code, but not normally.
91 session_name(
92     'session_for:'
93     . preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME']))
94 );
95 // Set an UTF-8 encoding header for internation characters (User attributes)
96 header('Content-Type: text/html; charset=utf-8');
97 ?>