This repository has been archived by the owner on May 10, 2019. It is now read-only.
/
index.html
119 lines (105 loc) · 3.23 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; width=device-width;">
<title>
BrowserID Relying Party
</title>
<style type="text/css">
body { margin: auto; font: 13px/1.5 Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif; }
a:link, a:visited { font-style: italic; text-decoration: none; color: #008; }
a:hover { border-bottom: 2px solid black ; }
.title { font-size: 2em; font-weight: bold; text-align: center; margin: 1.5em; }
.intro { font-size: 1.2em; width: 600px; margin: auto; }
.specify { font-size: 1.1em; width: 600px; padding-top: 2em; margin: auto; }
.assertion, .verifierResp { width: 600px; margin: auto; }
pre {
font-family: 'lucida console', monaco, 'andale mono', 'bitstream vera sans mono', consolas, monospace;
border: 3px solid #666;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
padding: .5em;
margin: .5em;
color: #ccc;
background-color: #333;
/* white-space: pre;*/
font-size: .9em;
width:600px;
word-wrap: break-word;
}
@media screen and (max-width: 640px) {
.intro, .output, .step {
width: 90%;
}
}
</style>
</head>
<body>
<div class="title">
BrowserID Test Relying Party
</div>
<div class="intro">
This is a RP for testing, it allows you to drive the <tt>navigator.id.get()</tt> call manually
to locally test BrowserID.
</div>
<div class="specify">
What flavor of assertion would you like? <br/>
<p>
<input type="checkbox" id="silent"> Silent <br/>
<input type="checkbox" id="allowPersistent"> Allow persistent sign-in <br/>
<input type="text" id="requiredEmail" width="80"> Require a specific email <br/>
<button>Get an assertion</button>
</p>
</div>
<div class="verifierResp">
<pre> ... verifier response ... </pre>
</div>
<div class="assertion">
<pre> ... ye' ol' assertion ... </pre>
</body>
</div>
<script src="jquery-min.js"></script>
<script src="https://browserid.org/include.js"></script>
<script>
// a function to check an assertion against the server
function checkAssertion(assertion) {
$.ajax({
url: "/process_assertion",
type: "post",
dataType: "json",
data: {
assertion: assertion,
audience: window.location.protocol + "//" + window.location.host
},
success: function(data, textStatus, jqXHR) {
$(".verifierResp > pre").text(JSON.stringify(data, null, 4));
},
error: function(jqXHR, textStatus, errorThrown) {
var resp = jqXHR.responseText ? JSON.parse(jqXHR.responseText) : errorThrown;
$(".verifierResp > pre").text(resp);
}
});
};
$(document).ready(function() {
$(".specify button").click(function() {
$("pre").text("... waiting ...");
var requiredEmail = $.trim($('#requiredEmail').val());
if (!requiredEmail.length) requiredEmail = undefined;
navigator.id.get(function(assertion) {
if (!assertion) {
$(".assertion pre").text("navigator.id.get() returns NULL");
} else {
$(".assertion pre").text(assertion);
checkAssertion(assertion);
}
}, {
silent: $('#silent').attr('checked'),
allowPersistent: $('#allowPersistent').attr('checked'),
requiredEmail: requiredEmail
});
});
});
</script>
</html>