1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file contains functions called by index.php. The index.php |
5
|
|
|
* file should include this file with the following statement at the top: |
6
|
|
|
* |
7
|
|
|
* require_once __DIR__ . '/index-functions.php'; |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
use CILogon\Service\Util; |
11
|
|
|
use CILogon\Service\Content; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* printLogonPage |
15
|
|
|
* |
16
|
|
|
* This function prints out the HTML for the IdP Selector page. |
17
|
|
|
* Explanatory text is shown as well as a button to log in to an IdP |
18
|
|
|
* and get rerouted to the Shibboleth protected testidp script. |
19
|
|
|
* |
20
|
|
|
* @param bool $clearcookies True if the Shibboleth cookies and session |
21
|
|
|
* variables should be cleared out before displaying the page. |
22
|
|
|
* Defaults to false. |
23
|
|
|
*/ |
24
|
|
|
function printLogonPage($clearcookies = false) |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
Util::setSessionVar('cilogon_skin', 'orcidfirst'); |
27
|
|
|
Util::getSkin(); |
28
|
|
|
if ($clearcookies) { |
29
|
|
|
Util::removeShibCookies(); |
30
|
|
|
Util::unsetAllUserSessionVars(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
Util::setSessionVar('stage', 'logon'); // For Show/Hide Help button clicks |
34
|
|
|
|
35
|
|
|
Content::printHeader('Test Your Identity Provider With CILogon'); |
36
|
|
|
|
37
|
|
|
echo ' |
38
|
|
|
<div class="boxed"> |
39
|
|
|
'; |
40
|
|
|
|
41
|
|
|
Content::printHelpButton(); |
42
|
|
|
|
43
|
|
|
echo ' |
44
|
|
|
<br /> |
45
|
|
|
<p> |
46
|
|
|
To test that your identity provider works with CILogon, please select |
47
|
|
|
it from the list below and Log On. |
48
|
|
|
</p> |
49
|
|
|
'; |
50
|
|
|
|
51
|
|
|
Content::printWAYF(false); |
52
|
|
|
|
53
|
|
|
echo ' |
54
|
|
|
</div> <!-- End boxed --> |
55
|
|
|
'; |
56
|
|
|
Content::printFooter(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* printMainPage |
61
|
|
|
* |
62
|
|
|
* This function prints the user attributes and IdP metadata after the user |
63
|
|
|
* has logged on. |
64
|
|
|
*/ |
65
|
|
|
function printMainPage() |
|
|
|
|
66
|
|
|
{ |
67
|
|
|
// If the 'idp' PHP session variable isn't set, then force the user to |
68
|
|
|
// start over by logging in again. |
69
|
|
|
$idp = Util::getSessionVar('idp'); |
70
|
|
|
if (empty($idp)) { |
71
|
|
|
printLogonPage(true); |
|
|
|
|
72
|
|
|
exit; // No further processing necessary |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
Util::setSessionVar('stage', 'main'); // For Show/Hide Help button clicks |
76
|
|
|
|
77
|
|
|
Content::printHeader('Test Identity Provider'); |
78
|
|
|
Content::printPageHeader('Test Your Organization\'s Identity Provider'); |
79
|
|
|
|
80
|
|
|
// CIL-626 Allow browser 'reload page' by adding CSRF to the PHP session |
81
|
|
|
Util::setSessionVar('submit', 'Proceed'); |
82
|
|
|
Util::getCsrf()->setTheSession(); |
83
|
|
|
|
84
|
|
|
echo ' |
85
|
|
|
<div class="boxed"> |
86
|
|
|
'; |
87
|
|
|
|
88
|
|
|
echo ' |
89
|
|
|
<div class="boxed"> |
90
|
|
|
<div class="boxheader"> |
91
|
|
|
Verify SAML Attribute Release Policy |
92
|
|
|
</div> |
93
|
|
|
|
94
|
|
|
<p> |
95
|
|
|
Thank you for your interest in the CILogon Service. This page allows |
96
|
|
|
the administrator of an Identity Provider (<acronym |
97
|
|
|
title="Identity Provider">IdP</acronym>) to verify that all necessary |
98
|
|
|
SAML attributes have been released to the CILogon Service Provider |
99
|
|
|
(<acronym title="Service Provider">SP</acronym>). Below you will see |
100
|
|
|
the various attributes required by the CILogon Service and their values |
101
|
|
|
as released by your IdP. |
102
|
|
|
</p> |
103
|
|
|
|
104
|
|
|
<div class="summary"> |
105
|
|
|
<h2>Summary</h2> |
106
|
|
|
'; |
107
|
|
|
|
108
|
|
|
$gotattrs = Util::gotUserAttributes(); |
|
|
|
|
109
|
|
|
|
110
|
|
|
if ($gotattrs) { |
111
|
|
|
echo '<div class="icon">'; |
112
|
|
|
Content::printIcon('okay'); |
113
|
|
|
echo ' |
114
|
|
|
</div> |
115
|
|
|
<div class="summarytext"> |
116
|
|
|
<p> |
117
|
|
|
All required attributes have been released by your <acronym |
118
|
|
|
title="Identity Provider">IdP</acronym>. For details of the various |
119
|
|
|
attributes utilized by the CILogon Service and their current values, |
120
|
|
|
see the sections below. |
121
|
|
|
</p> |
122
|
|
|
<p class="addsubmit"> |
123
|
|
|
<a href="/">Proceed to the CILogon Service</a> |
124
|
|
|
</p> |
125
|
|
|
<p class="addsubmit"> |
126
|
|
|
<a href="/logout">Logout</a> |
127
|
|
|
</p> |
128
|
|
|
</div> |
129
|
|
|
'; |
130
|
|
|
} else { |
131
|
|
|
echo '<div class="icon">'; |
132
|
|
|
Content::printIcon('error', 'Missing one or more attributes.'); |
133
|
|
|
echo ' |
134
|
|
|
</div> |
135
|
|
|
<div class="summarytext"> |
136
|
|
|
<p> |
137
|
|
|
One or more of the attributes required by the CILogon Service are |
138
|
|
|
not available. Please see the sections below for details. Contact |
139
|
|
|
<a href="mailto:[email protected]">help @ cilogon.org</a> |
140
|
|
|
for additional information and assistance. |
141
|
|
|
</p> |
142
|
|
|
</div> |
143
|
|
|
'; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
echo ' |
147
|
|
|
</div> <!-- summary --> |
148
|
|
|
|
149
|
|
|
<noscript> |
150
|
|
|
<div class="nojs"> |
151
|
|
|
Javascript is disabled. In order to expand or collapse the sections |
152
|
|
|
below, please enable Javascript in your browser. |
153
|
|
|
</div> |
154
|
|
|
</noscript> |
155
|
|
|
'; |
156
|
|
|
|
157
|
|
|
Content::printUserAttributes(); |
|
|
|
|
158
|
|
|
Content::printIdPMetadata(); |
|
|
|
|
159
|
|
|
|
160
|
|
|
echo ' |
161
|
|
|
</div> <!-- End boxed --> |
162
|
|
|
'; |
163
|
|
|
Content::printFooter(); |
164
|
|
|
} |
165
|
|
|
|
This check looks for functions that have already been defined in other files.
Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the
@ignore
annotation.See also the PhpDoc documentation for @ignore.