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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%request.setCharacterEncoding("UTF-8");%>
<%response.setCharacterEncoding("UTF-8");%>
<logic:present name="showComments" scope="Request">
<!-- TO CONFIGURE THIS FOR A SPECIFIC SITE
=====================================
Before you deploy this jsp you need to look for CONFIG below.
These mark places where you should make changes.
If you want to make more profound changes but only to the jsp,
you should read the sections marked PROGRAMMING NOTE below.-->
<!-- PROGRAMMING NOTE
"requestURL" contains the URL that was specified to get the
WAYF going. The jsp uses it mostly for submitting result back to
the WAYF and error reporting -->
</logic:present>
<jsp:useBean id="requestURL" scope="request" class="java.lang.String"/>
<logic:present name="showComments" scope="Request">
<!-- PROGRAMMING NOTE
shire, target, provider and time are all part of the Shibboleth
1.3 discovery protocol and need to be specified as parameters to the WAYF
entityID, return, returnIDParam are all part of the
SAML Discovery protocol.
-->
</logic:present>
<logic:notPresent name="entityID" scope="request">
<logic:notPresent name="shire" scope="request">
<jsp:forward page = "wayferror.jsp"/>
</logic:notPresent>
</logic:notPresent>
<logic:present name="showComments" scope="Request">
<!-- PROGRAMMING NOTE
In addition to the above. The WAYF may also supply the following to
the jsp.
"cookieList" If this exists it represents the contents of the
_saml_idp cookie (possibly filtered to remove IdPs which
cannot serve the SP). It is a Collection of IdPSite objects,
which themselves have the following properties:
"name" The uri for the IdP, which needs to be returned to the
WAYF in the "origin" parameter.
"displayName" User friendly name (taken from its alias)
"addressFor" The (ungarnished) URL for the IdP. This could be
used to create a direct hyperlink to the IdP
"sites" If this exists it contains all the possible IdPs for for
the SP (possibly filtered). It is a Collection of IdPSite
Objects which are described above. This is only present if
provideList was defined true in the configuration.
"siteLists" If this exists it contains all the possible metadata
files which can service for the SP (possibly filtered). It
is a collection of IdPSiteSetEntry Objects which have two
properties:
"name" This is the displayName from the Metadata element in
the WAYF configuration file
"sites" This represents the IdPs. Again it is a collection
of IdPSite Objects
It is only present if provideListOfList was defined true in
the configuration.
"singleSiteList" if this is present, then there is only one
IdPSiteSetEntry Object in "siteLists".
"searchresultempty" If this is present then it means that a
search was performed, but no suitable IdPs were returned.
"searchresults" If this is present it represents the list of IdPs
which matched a previous search. It is a Collection of
IdPSite Objects. -->
<!-- PROGRAMMING NOTE
The jsp communicates back to the WAYF via the parameters listed
above, and:
"action" what the WAYF has to do. Possible contents are:
"lookup" - refresh the screen.
"search" - perform a search on the contents parameter "string"
"selection" - redirect to the IdP with the uri "origin"
"cache" preserve any selection in the _saml_idp cookie. A
value of "session" makes the cookie last for the browser
session, "perm" gives it the lifetime specified in the
configuration file.
The tabindex is hard wired. Fortunately the standard allows us to
have duplicate numbers and says the order is the order things
get emitted. We use these numbers
10 - Recently used sites hyperlinks
20 - <clear button for above>
25 - AutoSuggestion
30 Federation selection
40 IdP within Selection
50 Select button
60 How long to remember selector
70 Search entry
80 Search Button
90 List of search results
100 Select search result
110 How long to remember search results
120 Hyperlink to admin user.
-->
</logic:present>
<head>
<link rel="stylesheet" title="normal" type="text/css"
href="wayf.css" /> <title>Identity Provider Selection</title>
</head>
<body>
<div class="head">
<h1>
Select an identity provider
</h1>
</div>
<div class="selector">
<p class="text">
<!--CONFIG-->
The Service you are trying to reach requires that you
authenticate with your home organization, enter the name below.
</p>
<logic:present name="cookieList" scope="request">
<h2>
Recently used organizations:
</h2>
<logic:present name="showComments" scope="Request">
<!-- PROGRAMMING NOTE
Generate a hyperlink back to the WAYF. Note that we are
simulating the user having specified a permanent cookie -->
</logic:present>
<logic:iterate id="site" name="cookieList">
<p class="text">
<logic:present name="entityID" scope="request">
<bean:define id="returnIDParam" name="returnIDParam"/>
<bean:define id="ei" name="entityID" />
<bean:define id="re" name="returnX"/>
<a tabindex="10" href="<bean:write name="requestURL" />?entityID=<%= java.net.URLEncoder.encode(ei.toString(), "utf-8") %>&return=<%= java.net.URLEncoder.encode(re.toString(), "utf-8") %>&returnIDxParam=<%= java.net.URLEncoder.encode( returnIDParam.toString(), "utf-8" ) %>&cache=perm&action=selection&origin=<jsp:getProperty name="site" property="name" />">
<jsp:getProperty name="site" property="displayName" />
</a>
</logic:present>
<logic:notPresent name="entityID" scope="request">
<bean:define id="targ" name="target" />
<bean:define id="shire" name="shire" />
<bean:define id="pid" name="providerId" />
<a tabindex="10" href="<bean:write name="requestURL" />?target=<%= java.net.URLEncoder.encode(targ.toString(),"utf-8") %>&shire=<%= java.net.URLEncoder.encode(shire.toString(),"utf-8") %>&providerId=<%= java.net.URLEncoder.encode(pid.toString(),"utf-8") %>&time=<bean:write name="time" />&cache=perm&action=selection&origin=<jsp:getProperty name="site" property="name" />">
<jsp:getProperty name="site"
property="displayName" />
</a>
</logic:notPresent>
</p>
</logic:iterate>
<logic:present name="showComments" scope="Request">
<!-- PROGRAMMING NOTE
We defined the ClearCache.Wayf service in wayfconfig. So we know
it is here. This will empty the cookie and loop -->
</logic:present>
<form method="get" action="ClearCache.wayf" >
<div>
<logic:notPresent name="entityID" scope="request">
<input type="hidden" name="shire" value="<bean:write name="shire" />" />
<input type="hidden" name="target" value="<bean:write name="target" />" />
<input type="hidden" name="providerId" value="<bean:write name="providerId" />" />
<logic:present name="time" scope="request">
<input type="hidden" name="time" value="<bean:write name="time" />" />
</logic:present>
</logic:notPresent>
<logic:present name="entityID" scope="request">
<input type="hidden" name="entityID" value="<bean:write name="entityID" />" />
<input type="hidden" name="returnX" value="<bean:write name="returnX" />" />
<input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" />
</logic:present>
<input tabindex="20" type="submit" value="Clear" />
</div>
</form>
</logic:present> <!-- Previous Selections -->
<logic:present name="showComments" scope="Request">
<!-- PROGRAMMING NOTE
Add the "instant serach" dialogue.
</logic:present>
<div class="list">
<logic:present name="sites" scope="request">
<h2>
Enter insititution name:
</h2>
<form autocomplete="OFF" action="">
<div>
<logic:notPresent name="entityID" scope="request">
<input type="hidden" name="shire" value="<bean:write name="shire" />" />
<input type="hidden" name="target" value="<bean:write name="target" />" />
<input type="hidden" name="providerId" value="<bean:write name="providerId" />" />
<logic:present name="time" scope="request">
<input type="hidden" name="time" value="<bean:write name="time" />" />
</logic:present>
</logic:notPresent>
<logic:present name="entityID" scope="request">
<input type="hidden" name="entityID" value="<bean:write name="entityID" />" />
<input type="hidden" name="returnX" value="<bean:write name="returnX" />" />
<input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" />
</logic:present>
<input type="hidden" id="enterOrigin" name="origin" value="unspec" />
<input type="hidden" id="enterType" name="action" value="search" />
<input type="text" id="enterText" name="string" value="" tabindex="25" size="54"/>
<input type="submit" id="enterSubmit" value="Search"/>
<input type="hidden" name="cache" value="perm"/>
</div>
</form>
</logic:present>
<h2>
<logic:present name="showComments" scope="Request">
Provide a static drop down or a dynamically republished one. - you may wish to remove this code
</logic:present>
Or choose from a list:
</h2>
<logic:present name="sites" scope="request">
<logic:notPresent name="siteLists" scope="request">
<form method="get" action="<bean:write name="requestURL" />">
<div>
<logic:notPresent name="entityID" scope="request">
<input type="hidden" name="shire" value="<bean:write name="shire" />" />
<input type="hidden" name="target" value="<bean:write name="target" />" />
<input type="hidden" name="providerId" value="<bean:write name="providerId" />" />
<logic:present name="time" scope="request">
<input type="hidden" name="time" value="<bean:write name="time" />" />
</logic:present>
</logic:notPresent>
<logic:present name="entityID" scope="request">
<input type="hidden" name="entityID" value="<bean:write name="entityID" />" />
<input type="hidden" name="returnX" value="<bean:write name="returnX" />" />
<input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" />
</logic:present>
<input type="hidden" name="action" value="selection" />
<select name="origin" id="hackForie6" tabindex="40">
<logic:iterate id="site" name="sites">
<option value="<jsp:getProperty name="site" property="name" />">
<jsp:getProperty name="site" property="displayName" />
</option>
</logic:iterate>
</select>
<input type="submit" value="Select" tabindex="50" />
<select name="cache" tabindex="60">
<option value="false"> Do not remember</option>
<option value="session" selected="selected"> Remember for session</option>
<option value="perm"> Remember for a week</option>
</select>
</div>
</form>
</logic:notPresent>
</logic:present>
<logic:present name="showComments" scope="Request">
<!-- PROGRAMMING NOTE
Build two tables side by side, one with the Federation names and 'ALL' (if apposite)
and the other will be dynamically populated with the members of that federation.
This needs to work in the face of no javascript, so we initially populate the
Right hand list with all the IdPs. The first Selection in the Left hand Table will
shrink this list
The 'lists of all IdPs' is derived from the one which java gives us (if it did)
otherwise it is derived by a double iteration through the List of Lists. This
makes for complicated looking code, but it's dead simple really.
-->
</logic:present>
<logic:present name="siteLists" scope="request">
<form method="get" action="<bean:write name="requestURL" />">
<div>
<logic:notPresent name="entityID" scope="request">
<input type="hidden" name="shire" value="<bean:write name="shire" />" />
<input type="hidden" name="target" value="<bean:write name="target" />" />
<input type="hidden" name="providerId" value="<bean:write name="providerId" />" />
<logic:present name="time" scope="request">
<input type="hidden" name="time" value="<bean:write name="time" />" />
</logic:present>
</logic:notPresent>
<logic:present name="entityID" scope="request">
<input type="hidden" name="entityID" value="<bean:write name="entityID" />" />
<input type="hidden" name="returnX" value="<bean:write name="returnX" />" />
<input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" />
</logic:present>
<table id="tab">
<tr>
<th>Federation </th>
<th>organization</th>
</tr>
<tr><td>
<select name="FedSelector" size="10" id="FedSelect" tabindex="30"
onchange="changedFed(this.form.origin,
this.form.FedSelector[this.form.FedSelector.selectedIndex].value);">
<logic:iterate id="siteset" name="siteLists">
<logic:present name="singleSiteList" scope="request">
<!-- Only One site so select it -->
<option value="<jsp:getProperty name="siteset" property="name"/>" selected="selected">
<jsp:getProperty name="siteset" property="name"/>
</option>
</logic:present>
<logic:notPresent name="singleSiteList" scope="request">
<option value="<jsp:getProperty name="siteset" property="name"/>">
<jsp:getProperty name="siteset" property="name"/>
</option>
</logic:notPresent>
</logic:iterate>
<logic:notPresent name="singleSiteList" scope="request">
<!-- More than one site so select the 'All' -->
<option value="ALL" selected="selected">
All Sites
</option>
</logic:notPresent>
</select></td><td>
<input type="hidden" name="action" value="selection" />
<select name="origin" size="10" id="originIdp" tabindex="40">
<logic:present name="sites" scope="request">
<logic:iterate id="site" name="sites">
<option value="<jsp:getProperty name="site" property="name" />">
<jsp:getProperty name="site" property="displayName" />
</option>
</logic:iterate>
</logic:present>
<logic:notPresent name="sites" scope="request">
<logic:iterate id="siteset" name="siteLists">
<logic:iterate id="site" name="siteset" property="sites">
<option value="<jsp:getProperty name="site" property="name" />">
<jsp:getProperty name="site" property="displayName" />
</option>
</logic:iterate>
</logic:iterate>
</logic:notPresent>
</select>
</td></tr>
</table>
<p>
<input type="submit" value="Select" tabindex="50" />
<select name="cache" tabindex="60" >
<option value="false"> Do not remember</option>
<option value="session" selected="selected"> Remember for session</option>
<option value="perm"> Remember for a week</option>
</select>
</p>
</div>
</form>
</logic:present>
</div>
<div class="search">
<logic:present name="showComments" scope="Request">
<!-- This is here for completeness - it shows the "old fashioned way" to do search -->
<span class="option">or</span>
<h2>
Search by keyword:
</h2>
<form method="get" action="<bean:write name="requestURL" />">
<div>
<p>
<logic:notPresent name="entityID" scope="request">
<input type="hidden" name="shire" value="<bean:write name="shire" />" />
<input type="hidden" name="target" value="<bean:write name="target" />" />
<input type="hidden" name="providerId" value="<bean:write name="providerId" />" />
<logic:present name="time" scope="request">
<input type="hidden" name="time" value="<bean:write name="time" />" />
</logic:present>
</logic:notPresent>
<logic:present name="entityID" scope="request">
<input type="hidden" name="entityID" value="<bean:write name="entityID" />" />
<input type="hidden" name="returnX" value="<bean:write name="returnX" />" />
<input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" />
</logic:present>
<input type="hidden" name="action" value="search" />
<input type="text" name="string" tabindex="70" />
<input type="submit" value="Search" tabindex="80" />
</p>
</div>
</form>
<!-- The end of the old code. Below is where search results go 00>
</logic:present>
<logic:present name="searchResultsEmpty" scope="request">
<p class="error">
No provider was found that matches your search criteria, please try again.
</p>
</logic:present>
<logic:present name="searchresults" scope="request">
<h3>
Search results:
</h3>
<form method="get" action="<bean:write name="requestURL" />">
<div>
<ul>
<logic:iterate id="currResult" name="searchresults">
<li>
<input type="radio" name="origin" tabindex="90" value="<jsp:getProperty name="currResult" property="name" />" />
<jsp:getProperty name="currResult" property="displayName" />
</li>
</logic:iterate>
</ul>
<p>
<logic:notPresent name="entityID" scope="request">
<input type="hidden" name="shire" value="<bean:write name="shire" />" />
<input type="hidden" name="target" value="<bean:write name="target" />" />
<input type="hidden" name="providerId" value="<bean:write name="providerId" />" />
<logic:present name="time" scope="request">
<input type="hidden" name="time" value="<bean:write name="time" />" />
</logic:present>
</logic:notPresent>
<logic:present name="entityID" scope="request">
<input type="hidden" name="entityID" value="<bean:write name="entityID" />" />
<input type="hidden" name="returnX" value="<bean:write name="returnX" />" />
<input type="hidden" name="returnIDParam" value="<bean:write name="returnIDParam" />" />
</logic:present>
<input type="hidden" name="action" value="selection" />
<input type="submit" value="Select" tabindex="100" />
<select name="cache" tabindex="100" >
<option value="false"> Do not remember</option>
<option value="session" selected="selected"> Remember for session</option>
<option value="perm"> Remember for a week</option>
</select>
</p>
</div>
</form>
</logic:present>
</div>
</div>
<div class="footer">
<p class="text">
<!--CONFIG-->
Need assistance? Send mail to <a tabindex="120" href="mailto:noc@nordu.net">NORDUnet NOC</a> with description.
</p>
<div class="logo"><img src="images/NORDUnet2.jpg" alt="NORDUNet" /></div>
</div>
<logic:present name="showComments" scope="Request">
<!--PROGRAMMING NOTE
We need to program the on changed selector. Note that option.InnterText only
works on IE, options.remove doesn't work on Firefox, and that
options.add doesn't work on Safari. Hence the somewhat strange manipulations
to delete & populate the list of options.
X is the select object for the right hand table
Selected is the name selected in the left hand table
-->
</logic:present>
<logic:present name="siteLists" scope="request">
<script language="javascript" type="text/javascript">
<!--
function changedFed(X, Selected) {
<logic:notPresent name="singleSiteList" scope="request">
while (X.length > 0) {
X.options[(X.length-1)] = null;
}
<logic:iterate id="siteset" name="siteLists">
if (Selected == "<jsp:getProperty name="siteset" property="name"/>") {
var opt;
<logic:iterate id="site" name="siteset" property="sites">
opt = new Option ("<jsp:getProperty name="site" property="displayName" />");
X.options[X.length] = opt;
opt.value = "<jsp:getProperty name="site" property="name" />";
</logic:iterate>
}
</logic:iterate>
if (Selected == "ALL") {
var opt;
<logic:present name="sites" scope="request">
<logic:iterate id="site" name="sites">
opt = new Option("<jsp:getProperty name="site" property="displayName" />");
X.options[X.length] = opt;
opt.value = "<jsp:getProperty name="site" property="name" />";
</logic:iterate>
</logic:present>
<logic:notPresent name="sites" scope="request">
<logic:iterate id="siteset" name="siteLists">
<logic:iterate id="site" name="siteset" property="sites">
opt = new Option ("<jsp:getProperty name="site" property="displayName" />");
X.options[X.length] = opt;
opt.value = "<jsp:getProperty name="site" property="name" />";
</logic:iterate>
</logic:iterate>
</logic:notPresent>
}
</logic:notPresent>
}
-->
</script>
</logic:present>
<logic:present name="sites" scope="request">
<logic:present name="showComments" scope="Request">
<!-- Load the autosuggest code.
PROGRAMMING NOTE - the "ie6Hack" is to do with an issue in ie6 in which the
psuedo drop down floats below the real dropdown. The hack is that we jsut disable
the real drop down when the pseudo one is about. This can seem weird for some
layouts and so if you are not deploying against ie6 you can just send an
empty array.
-->
</logic:present>
<script language="javascript" type="text/javascript" src="Suggest.js"></script>
<script language="javascript" type="text/javascript">
<!--
window.onload = function() {
<logic:notPresent name="siteLists" scope="request">
var ie6Hack = [ document.getElementById("hackForie6")];
</logic:notPresent>
<logic:present name="siteLists" scope="request">
var ie6Hack = [ document.getElementById("FedSelect"), document.getElementById("originIdp")];
</logic:present>
var control = new TypeAheadControl(theElements,
document.getElementById("enterText"),
document.getElementById("enterOrigin"),
document.getElementById("enterSubmit"),
document.getElementById("enterType"),
ie6Hack);
document.getElementById("enterText").focus();
}
var theElements = [
<logic:iterate id="site" name="sites">
["<%= ((edu.internet2.middleware.shibboleth.wayf.IdPSite)site).getDisplayName().replace("\n","").toString() %>",
"<jsp:getProperty name="site" property="name" />"],
</logic:iterate>
];
-->
</script>
</logic:present>
</body>
</html>
|