-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.xhtml
548 lines (524 loc) · 27.5 KB
/
index.xhtml
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
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title/>
<link rel="stylesheet" href="resources/css/bootstrap.min.css"/>
<link rel="stylesheet" href="resources/css/font-awesome.min.css"/>
<link rel="stylesheet" href="resources/css/animate.min.css"/>
<link rel="stylesheet" href="resources/css/styles.css"/>
</head>
<body class="xforms">
<div style="display:none;">
<xf:model id="m-ca">
<xf:instance xmlns="" id="i-default">
<CA name="" nicename="">
<keysize/>
<expire/>
<capass/>
<expiry-date/>
<dnsname/>
<country/>
<province/>
<city/>
<org/>
<org-unit/>
<email/>
<cacert/>
<cakey/>
<pending-requests>
<req name="" type=""/>
</pending-requests>
<rejected-requests>
<req name="" type="" rej-reason=""/>
</rejected-requests>
</CA>
</xf:instance>
<xf:bind ref="instance('i-default')">
<xf:bind ref="@name" required="true()"/>
<xf:bind ref="dnsname" required="true()"/>
<xf:bind ref="keysize" required="true()"/>
<xf:bind ref="expire" required="true()" type="xf:integer"/>
<xf:bind ref="capass" required="true()"/>
<xf:bind ref="expiry-date"/>
</xf:bind>
<xf:submission id="s-createCA" ref="instance('i-default')" method="post" replace="instance" contentType="text/xml" resource="{$contextPath}/modules/create-ca.xql">
<xf:action ev:event="xforms-submit-error">
<xf:message level="ephemeral">An Error occurred during creation of Trust Center</xf:message>
</xf:action>
<xf:action ev:event="xforms-submit-done">
<xf:message level="ephemeral">Trust Center successfully created</xf:message>
<xf:send submission="s-create-cert"/>
</xf:action>
</xf:submission>
<xf:submission id="s-create-cert" ref="instance('i-default')" method="post" replace="instance" contentType="text/xml" resource="{$contextPath}/modules/create-cert.xql">
<xf:action ev:event="xforms-submit-error">
<xf:message level="ephemeral">An Error occurred during creation of cert for your server '<xf:output ref="dnsname"/>'</xf:message>
</xf:action>
<xf:action ev:event="xforms-submit-done">
<xf:message level="ephemeral">Server Cert for '<xf:output ref="dnsname"/>' successfully created</xf:message>
<xf:toggle case="home"/>
</xf:action>
</xf:submission>
<xf:submission id="s-config-jetty" ref="instance('i-default')" method="post" replace="instance" contentType="text/xml" resource="{$contextPath}/modules/reconfig-jetty.xql">
<xf:action ev:event="xforms-submit-error">
<xf:message level="ephemeral">An Error occurred during creation of cert for your server '<xf:output ref="dnsname"/>'</xf:message>
</xf:action>
<xf:action ev:event="xforms-submit-done">
<xf:message level="ephemeral">Server Cert for '<xf:output ref="dnsname"/>' successfully created</xf:message>
<xf:toggle case="home"/>
</xf:action>
</xf:submission>
<xf:instance xmlns="" id="i-cas">
<data/>
</xf:instance>
<xf:submission id="s-load-cas" resource="modules/get-ca.xql" method="get" replace="instance" ref="instance('i-cas')"/>
<xf:instance xmlns="" id="i-certs">
<certs/>
</xf:instance>
<xf:submission id="s-load-certs" resource="modules/list-certs.xql" method="get" replace="instance" ref="instance('i-certs')"/>
<xf:instance xmlns="" id="i-vars">
<data>
<retype/>
<mode>create-ca</mode>
</data>
</xf:instance>
<xf:bind ref="instance('i-vars')">
<xf:bind ref="retype" constraint=". eq instance('i-default')/capass" required="true()"/>
</xf:bind>
<!-- ### the following is not used yet ###
<xf:instance xmlns="" id="i-countries" src="data/countries.xml"/>
-->
<xf:action ev:event="xforms-ready">
<xf:send submission="s-load-cas"/>
<xf:send submission="s-load-certs"/>
<xf:toggle case="create-ca" if="not(exists(instance('i-cas')/CA))"/>
</xf:action>
</xf:model>
</div>
<!--
<header>
<div class="button-bar">
<xf:trigger class="-btn -btn-default">
<xf:label>
<i class="fa fa-arrow-left"/>
</xf:label>
<xf:toggle case="home"/>
</xf:trigger>
<xf:trigger id="ca-config" class="-btn -btn-default">
<xf:label>
<i class="fa fa-institution"/>
</xf:label>
<xf:toggle case="create-ca"/>
</xf:trigger>
</div>
</header>
-->
<div class="app-name">
<!--
<xf:trigger>
<xf:label>flip</xf:label>
<xf:toggle case="home"/>
</xf:trigger>
<xf:trigger id="dummy">
<xf:label>toggle</xf:label>
<xf:toggle case="cert"/>
</xf:trigger> -->
<i class="fa fa-key"/>MeCastle</div>
<xf:switch id="views" class="bf-panel fadeIn animated">
<xf:case id="CA-home">
<h2>Your trustchains</h2>
<!--
<xf:repeat ref="cas/CA" appearance="minimal">
<xf:output ref="@name" class="ca-name">
<xf:label/>
</xf:output>
<xf:output ref="expire" class="ca-expires">
<xf:label/>
</xf:output>
<xf:output value="days-to-date(days-from-date(now())+ expire)">
<xf:label>date:</xf:label>
</xf:output>
</xf:repeat>
-->
</xf:case>
<xf:case id="home" selected="true">
<xf:action ev:event="xforms-select">
<script>
$("#home").addClass("fadeInLeft animated");
</script>
</xf:action>
<xf:action ev:event="xforms-deselect">
<script>
$("#home").removeClass("fadeInLeft animated");
</script>
</xf:action>
<h3>All Certificates</h3>
<xf:repeat ref="instance('i-certs')/cert" appearance="compact" class="table table-hover cert-list">
<xf:output ref="@name">
<xf:label>Name</xf:label>
</xf:output>
<xf:output ref="expiry-date">
<xf:label>Expires</xf:label>
</xf:output>
<xf:output ref="status">
<xf:label>
<i class="fa fa-lock fa-lg active"/>
</xf:label>
</xf:output>
</xf:repeat>
<table class="table table-hover cert-list ">
<thead>
<tr>
<td>Name</td>
<td>Expires</td>
<td>Status</td>
</tr>
</thead>
<tr>
<td>existdb.org</td>
<td>2018-01-01</td>
<td title="active">
<i class="fa fa-lock fa-lg active"/>
</td>
</tr>
<tr>
<td>joern@existsolutions.com</td>
<td>2017-01-05</td>
<td title="active">
<i class="fa fa-lock fa-lg active"/>
</td>
</tr>
<tr>
<td>wolfgang@existsolutions.com</td>
<td>2017-01-05</td>
<td title="pending approval">
<i class="fa fa-unlock fa-lg pending"/>
</td>
</tr>
<tr>
<td>existsolutions.com</td>
<td>2ß20-04-07</td>
<td title="expired">
<span class="fa-stack fa-lg">
<i class="fa fa-lock"/>
<i class="fa fa-ban fa-stack-2x text-danger"/>
</span>
</td>
</tr>
</table>
</xf:case>
<xf:case id="create-ca" selected="true">
<xf:action ev:event="xforms-select">
<script>
$("#create-ca").addClass("fadeInDown animated");
</script>
</xf:action>
<xf:action ev:event="xforms-deselect">
<script>
$("#create-ca").removeClass("fadeOutUp animated");
</script>
</xf:action>
<i id="reload" class="fa fa-rotate-left btn"/>
<h3>Setup your Trust Center</h3>
<xf:group id="summary" appearance="minimal">
<img src="resources/images/gray-cert-light.png"/>
<div class="cert-text">
<xf:output ref="@name" class="summary-long summary-name">
<xf:label>CA Name</xf:label>
</xf:output>
<xf:output ref="keysize" class="summary-short summary-keysize">
<xf:label>Key length</xf:label>
</xf:output>
<xf:output ref="expiry-date" class="summary-short summary-expire">
<xf:label>Expires</xf:label>
</xf:output>
</div>
</xf:group>
<ol class="carousel-indicators">
<li class="active"/>
<li/>
<li/>
<li/>
<li/>
<li/>
</ol>
<xf:group class="CA-form" appearance="compact">
<ul>
<li class="name-item">
<xf:input id="ca-name" ref="@name" class="-form-control" autofocus="autofocus">
<xf:label>Name</xf:label>
<xf:action ev:event="xforms-value-changed">
<script>
$(".name-item > input").addClass("fadeOutUp animated");
$(".summary-name").addClass("fadeInUp animated");
$(".name-item").addClass("hidden");
$(".keysize-item").removeClass("hidden");
$(".keysize-item").addClass("fadeInUp animated");
$(".carousel-indicators .active").removeClass("active");
$(".carousel-indicators li:nth-child(2)").addClass("active");
</script>
</xf:action>
</xf:input>
<div class="alert alert-info">
<i class="fa fa-info"/>
Please input a descriptive name for your trust center. <br/>
<h5>Examples:</h5>
<ul>
<li>John Doe</li>
<li>mycompany.com</li>
</ul>
</div>
</li>
<li class="keysize-item hidden">
<h3>Level of Security</h3>
<div class="keysize-btn bit2048 btn btn-warning" role="button" tabindex="0" title="standard security level">
<!-- <h5>Standard</h5> -->
<i class="fa fa-key"/>
<span>2048 bit</span>
</div>
<div class="keysize-btn bit4096 btn btn-warning" role="button" tabindex="0" title="high security level">
<i class="fa fa-key"/>
<span>4096 bit</span>
</div>
<div class="keysize-btn bit8192 btn btn-warning" role="button" tabindex="0" title="extreme security level">
<i class="fa fa-key"/>
<span>8192 bit</span>
</div>
<xf:select1 id="key-size" ref="keysize" selection="closed" class="-form-control" appearance="full" incremental="true">
<xf:label>Keysize</xf:label>
<xf:item>
<xf:label>2048 bit</xf:label>
<xf:value>2048</xf:value>
</xf:item>
<xf:item>
<xf:label>4096 bit</xf:label>
<xf:value>4096</xf:value>
</xf:item>
<xf:item>
<xf:label>8192 bit</xf:label>
<xf:value>8192</xf:value>
</xf:item>
<xf:action ev:event="xforms-value-changed" style="display:none;visibility:hidden;">
<script>
$(".keysize-item > input").addClass("fadeOutUp animated");
$(".summary-keysize").addClass("fadeInUp animated");
$(".keysize-item").addClass("hidden");
$(".expire-item").removeClass("hidden");
$(".expire-item").addClass("fadeInUp animated");
$(".carousel-indicators .active").removeClass("active");
$(".carousel-indicators li:nth-child(3)").addClass("active");
</script>
</xf:action>
</xf:select1>
<div class="alert alert-info">
<i class="fa fa-info"/>The length of the encryption key. The longer the key the more
secure the encryption. However long keys take more processsion power and might slow down
your server.
</div>
</li>
<li class="expire-item hidden">
<h3>Expires in</h3>
<div class="expire-btn oneyear btn btn-warning" role="button" tabindex="0" title="expires in 1 year">
<span>1 year</span>
</div>
<div class="expire-btn threeyears btn btn-warning" role="button" tabindex="0" title="expires in 3 years">
<span>3 years</span>
</div>
<div class="expire-btn fiveyears btn btn-warning" role="button" tabindex="0" title="expires in 5 years">
<span>5 years</span>
</div>
<xf:select1 id="expire" ref="expire" selection="closed" class="-form-control" appearance="full" incremental="true">
<xf:label>Expires</xf:label>
<xf:item>
<xf:label>1 year</xf:label>
<xf:value>365</xf:value>
</xf:item>
<!-- <xf:item>-->
<!-- <xf:label>2 years</xf:label>-->
<!-- <xf:value>730</xf:value>-->
<!-- </xf:item>-->
<xf:item>
<xf:label>3 years</xf:label>
<xf:value>1095</xf:value>
</xf:item>
<!-- <xf:item>-->
<!-- <xf:label>4 years</xf:label>-->
<!-- <xf:value>1460</xf:value>-->
<!-- </xf:item>-->
<xf:item>
<xf:label>5 years</xf:label>
<xf:value>1825</xf:value>
</xf:item>
<xf:action ev:event="xforms-value-changed">
<xf:setvalue ref="../expiry-date" value="days-to-date(days-from-date(now()) + ../expire)"/>
<script>
$(".expire-item > input").addClass("fadeOutUp animated");
$(".summary-expire").addClass("fadeInUp animated");
$(".expire-item").addClass("hidden");
$(".pass-item").removeClass("hidden");
$(".pass-item").addClass("fadeInUp animated");
$(".carousel-indicators .active").removeClass("active");
$(".carousel-indicators li:nth-child(4)").addClass("active");
</script>
</xf:action>
</xf:select1>
<div class="alert alert-info">
<i class="fa fa-info"/>The duration of validity.</div>
</li>
<li class="pass-item hidden">
<xf:secret ref="capass" class="-form-control">
<xf:label>CA Password</xf:label>
</xf:secret>
<xf:secret ref="instance('i-vars')/retype" class="-form-control hidden">
<xf:label>Retype CA password</xf:label>
<xf:alert>Passwords do not match</xf:alert>
<xf:action ev:event="xforms-value-changed" if=". = instance('i-default')/capass">
<script>
$(".pass-item > input").addClass("fadeOutUp animated");
$(".pass-item").addClass("hidden");
$(".server-item").removeClass("hidden");
$(".server-item").addClass("fadeInUp animated");
$(".carousel-indicators .active").removeClass("active");
$(".carousel-indicators li:nth-child(5)").addClass("active");
</script>
</xf:action>
</xf:secret>
<div class="alert alert-danger">
<i class="fa fa-exclamation-circle"/>
Please make sure that you keep this password in a safe place. If you loose this password you'll loose
access to your encrypted data - bla </div>
</li>
<li class="server-item hidden">
<xf:input ref="dnsname" class="-form-control hidden">
<xf:label>Hostname</xf:label>
<xf:hint>existca.example.org</xf:hint>
<xf:action ev:event="xforms-value-changed">
<script>
$(".server-item > input").addClass("fadeOutUp animated");
$(".server-item").addClass("hidden");
$(".btn-group").removeClass("hidden");
$(".btn-group").addClass("fadeInUp animated");
$(".carousel-indicators .active").removeClass("active");
$(".carousel-indicators li:nth-child(6)").addClass("active");
</script>
</xf:action>
</xf:input>
<div class="alert alert-info">
<i class="fa fa-info"/>The name of your server...</div>
</li>
<li class="btn-group hidden">
<xf:trigger class="-btn -btn-success -btn-lg create-ca">
<xf:label>Create</xf:label>
<xf:action>
<xf:send submission="s-createCA"/>
<script>
$(".progress .step").addClass("slideInLeft animated");
</script>
</xf:action>
</xf:trigger>
</li>
</ul>
</xf:group>
<!-- <div class="progress">-->
<!-- <span class="step step1"/>-->
<!-- </div>-->
</xf:case>
<xf:case id="cert">
<xf:action ev:event="xforms-select">
<script>
$("#cert").addClass("fadeInRight animated");
</script>
</xf:action>
<xf:action ev:event="xforms-deselect">
<script>
$("#cert").removeClass("fadeInRight animated");
</script>
</xf:action>
<h1>Cert Details</h1>
</xf:case>
<xf:case id="expert">
<xf:group appearance="full" ref="cas/CA">
<ul>
<li>
<xf:input ref="org">
<xf:label>Organisation</xf:label>
</xf:input>
</li>
<li>
<xf:input ref="org-unit">
<xf:label>Organisational Unit</xf:label>
</xf:input>
</li>
<li>
<xf:input ref="province">
<xf:label>State / Province</xf:label>
</xf:input>
</li>
<li>
<xf:input ref="city">
<xf:label>City</xf:label>
</xf:input>
</li>
<li>
<xf:select1 ref="country" appearance="minimal">
<xf:label>Country</xf:label>
<xf:itemset nodeset="instance('i-countries')/country">
<xf:label ref="."/>
<xf:value ref="@code"/>
</xf:itemset>
</xf:select1>
</li>
<li>
<xf:secret ref="capass">
<xf:label>CA Password</xf:label>
</xf:secret>
</li>
<li>
<xf:secret ref="instance('i-vars')/retype">
<xf:label>Retype CA password</xf:label>
</xf:secret>
</li>
<li>
<xf:input ref="email">
<xf:label>Email</xf:label>
</xf:input>
</li>
</ul>
</xf:group>
</xf:case>
</xf:switch>
<script type="text/javascript" src="resources/scripts/jquery.min.js"/>
<script>
$(document).ready(function() {
fluxProcessor.skipshutdown=true;
$("#reload").on("click",function(){
window.location.reload();
});
$("tr").on("click",function(){
console.log("tr clicked");
fluxProcessor.dispatchEvent("dummy");
});
$(".keysize-btn.bit2048").on("click",function(){
console.log("2048 was clicked");
fluxProcessor._setControlValue("key-size","2048");
});
$(".keysize-btn.bit4096").on("click",function(){
fluxProcessor._setControlValue("key-size","4096");
});
$(".keysize-btn.bit8192").on("click",function(){
fluxProcessor._setControlValue("key-size","8192");
});
$(".expire-btn.oneyear").on("click",function(){
console.log("clicked on year");
fluxProcessor._setControlValue("expire","365");
});
$(".expire-btn.threeyears").on("click",function(){
fluxProcessor._setControlValue("expire","1095");
});
$(".expire-btn.fiveyears").on("click",function(){
fluxProcessor._setControlValue("expire","1825");
});
});
</script>
</body>
</html>