phpCAS
version 1.4.0
docs
examples
example_proxy_rebroadcast.php
Go to the documentation of this file.
1
<?php
2
18
// Load the settings from the central config file
19
require_once
'config.php'
;
20
// Load the CAS lib
21
require_once
$phpcas_path
.
'/CAS.php'
;
22
23
// Enable debugging
24
phpCAS::setLogger
();
25
// Enable verbose error messages. Disable in production!
26
phpCAS::setVerbose
(
true
);
27
28
// Initialize phpCAS
29
phpCAS::proxy
(
CAS_VERSION_2_0
,
$cas_host
,
$cas_port
,
$cas_context
);
30
31
// For production use set the CA certificate that is the issuer of the cert
32
// on the CAS server and uncomment the line below
33
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
34
35
// For quick testing you can disable SSL validation of the CAS server.
36
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
37
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
38
phpCAS::setNoCasServerValidation
();
39
40
// Set the nodes for rebroadcasting pgtIou/pgtId and logoutRequest
41
phpCAS::addRebroadcastNode
(
$rebroadcast_node_1
);
42
phpCAS::addRebroadcastNode
(
$rebroadcast_node_2
);
43
44
// handle incoming logout requests
45
phpCAS::handleLogoutRequests
();
46
47
// force CAS authentication
48
phpCAS::forceAuthentication
();
49
50
// at this step, the user has been authenticated by the CAS server
51
// and the user's login name can be read with phpCAS::getUser().
52
53
?>
54
<html>
55
<head>
56
<title>
phpCAS
proxy rebroadcast example</title>
57
<link rel=
"stylesheet"
type=
'text/css'
href=
'example.css'
/>
58
</head>
59
<body>
60
<h1>
phpCAS
proxy rebroadcast example</h1>
61
<p>the user
's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
62
</body>
63
</html>
phpCAS\forceAuthentication
static forceAuthentication()
Definition:
CAS.php:1146
phpCAS
Definition:
CAS.php:281
phpCAS\handleLogoutRequests
static handleLogoutRequests($check_client=true, $allowed_clients=array())
Definition:
CAS.php:1324
phpCAS\addRebroadcastNode
static addRebroadcastNode($rebroadcastNodeUrl)
Definition:
CAS.php:1837
phpCAS\proxy
static proxy($server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true, \SessionHandlerInterface $sessionHandler=null)
Definition:
CAS.php:391
$phpcas_path
$phpcas_path
Definition:
config.example.php:20
$rebroadcast_node_2
$rebroadcast_node_2
Definition:
config.example.php:79
phpCAS\setLogger
static setLogger($logger=null)
Definition:
CAS.php:448
CAS_VERSION_2_0
const CAS_VERSION_2_0
Definition:
CAS.php:78
phpCAS\setVerbose
static setVerbose($verbose)
Definition:
CAS.php:512
$cas_host
$cas_host
Definition:
config.example.php:27
$cas_context
$cas_context
Definition:
config.example.php:30
$cas_port
$cas_port
Definition:
config.example.php:33
phpCAS\setNoCasServerValidation
static setNoCasServerValidation()
Definition:
CAS.php:1689
$rebroadcast_node_1
$rebroadcast_node_1
Definition:
config.example.php:78
Generated by
1.8.13