-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcasu.php
More file actions
67 lines (57 loc) · 1.43 KB
/
testcasu.php
File metadata and controls
67 lines (57 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
//defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
$phpcas_path = 'include/phpCAS/source/';
$cas_host = 'cas.univ-paris1.fr';
$cas_context = '/cas';
$cas_port = 443;
$cas_url = 'https://' . $cas_host;
if ($cas_port != '443') {
$cas_url = $cas_url . ':' . $cas_port;
}
$cas_url = $cas_url . $cas_context;
require_once $phpcas_path . '/CAS.php';
phpCAS::setLogger();
phpCAS::setVerbose(true);
phpCAS::client(
CAS_VERSION_2_0,
$conf['casu']['casu_host'],
(int)$conf['casu']['casu_port'],
$conf['casu']['casu_context'],
$serviceUrl,
false
);
phpCAS::setNoCasServerValidation();
phpCAS::forceAuthentication();
// Some small code triggered by the logout button
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
?>
<html>
<head>
<title>Advanced SAML 1.1 example</title>
</head>
<body>
<h2>Advanced SAML 1.1 example</h2>
<?//php require 'script_info.php' ?>
Authentication succeeded for user
<strong><?php echo phpCAS::getUser(); ?></strong>.
<h3>User Attributes</h3>
<ul>
<?php
foreach (phpCAS::getAttributes() as $key => $value) {
if (is_array($value)) {
echo '<li>', $key, ':<ol>';
foreach ($value as $item) {
echo '<li><strong>', $item, '</strong></li>';
}
echo '</ol></li>';
} else {
echo '<li>', $key, ': <strong>', $value, '</strong></li>' . PHP_EOL;
}
}
?>
</ul>
<p><a href="?logout=">Logout</a></p>
</body>
</html>