Upgrade phpCAS
[piwik-CASLogin.git] / CAS / docs / examples / example_lang.php
1 <?php
2
3 /**
4  *  Example that changes language of phpcas pages
5  *
6  * PHP Version 5
7  *
8  * @file     example_lang.php
9  * @category Authentication
10  * @package  PhpCAS
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
15  */
16
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 // Uncomment to enable debugging
23 phpCAS::setDebug();
24
25 // Initialize phpCAS
26 phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
27
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);
31
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();
36
37 // set the language to french
38 phpCAS::setLang(PHPCAS_LANG_FRENCH);
39
40 // force CAS authentication
41 phpCAS::forceAuthentication();
42
43 // at this step, the user has been authenticated by the CAS server
44 // and the user's login name can be read with phpCAS::getUser().
45
46 // moreover, a PGT was retrieved from the CAS server that will
47 // permit to gain accesses to new services.
48
49 // for this test, simply print that the authentication was successfull
50 ?>
51 <html>
52   <head>
53     <title>Exemple d'internationalisation de phpCAS</title>
54   </head>
55   <body>
56     <h1>Authentification r&eacute;ussie&nbsp;!</h1>
57     <?php require 'script_info.php' ?>
58     <p>L'utilisateur connect&eacute; est <b><?php echo phpCAS::getUser(); ?></b>.</p>
59     <p>La version de phpCAS est <b><?php echo phpCAS::getVersion(); ?></b>.</p>
60   </body>
61 </html>