-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestcasu.php.bak
57 lines (50 loc) · 1.32 KB
/
testcasu.php.bak
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
<?php
defined('CASU_PATH') or die('Hacking attempt!');
$phpcas_path = 'plugins/casusers/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::setDebug();
phpCAS::setVerbose(true);
phpCAS::client(SAML_VERSION_1_1, $cas_host, $cas_port, $cas_context);
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>