phpCAS
version 1.4.0
docs
examples
example_logout.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
23
phpCAS::setLogger
();
24
// Enable verbose error messages. Disable in production!
25
phpCAS::setVerbose
(
true
);
26
27
// Initialize phpCAS
28
phpCAS::client
(
CAS_VERSION_2_0
,
$cas_host
,
$cas_port
,
$cas_context
);
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!
37
phpCAS::setNoCasServerValidation
();
38
39
// handle incoming logout requests
40
phpCAS::handleLogoutRequests
();
41
42
// Or as an advanced featue handle SAML logout requests that emanate from the
43
// CAS host exclusively.
44
// Failure to restrict SAML logout requests to authorized hosts could
45
// allow denial of service attacks where at the least the server is
46
// tied up parsing bogus XML messages.
47
// phpCAS::handleLogoutRequests(true, $cas_real_hosts);
48
49
// force CAS authentication
50
phpCAS::forceAuthentication
();
51
52
// for this test, simply print that the authentication was successfull
53
?>
54
<html>
55
<head>
56
<title>
phpCAS
simple client</title>
57
</head>
58
<body>
59
<h1>Successfull Authentication!</h1>
60
<?php require
'script_info.php'
?>
61
<p>the user
's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
62
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
63
</body>
64
</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\client
static client($server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true, \SessionHandlerInterface $sessionHandler=null)
Definition:
CAS.php:345
$phpcas_path
$phpcas_path
Definition:
config.example.php:20
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
Generated by
1.8.13