Skip to content

Commit 6c25351

Browse files
NFC-47 Add mobile authentication docs and separate "Authenticate on mobile device" button
1 parent fd81283 commit 6c25351

File tree

1 file changed

+80
-25
lines changed

1 file changed

+80
-25
lines changed

example/src/main/resources/templates/index.html

Lines changed: 80 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,22 @@ <h2>Web eID: electronic ID smart cards on the Web</h2>
3939
<h4>Table of contents</h4>
4040
<ul>
4141
<li><a href="#usage">Usage</a></li>
42+
<ul>
43+
<li><a href="#usage-pc">Web eID</a></li>
44+
<li><a href="#usage-mobile">Web eID for Mobile</a></li>
45+
</ul>
4246
<li><a href="#documentation">Documentation</a>
4347
<li><a href="#for-developers">For developers</a>
4448
</ul>
4549

4650
<hr/>
4751
<h3><a id="usage"></a>Usage</h3>
52+
<h4 id="usage-pc">Web eID</h4>
4853
<p>The recommended way of installing Web eID is by installing
49-
<a href="https://www.id.ee/en/article/install-id-software/">the latest Open-EID ID-software package</a>.
50-
In case you do not need or want to install the Open-EID package, install the latest Web eID packages in
54+
<a href="https://www.id.ee/en/article/install-id-software/">the latest Open-EID ID-software
55+
package</a>.
56+
In case you do not need or want to install the Open-EID package, install the latest Web eID
57+
packages in
5158
Firefox, Chrome, Edge or Safari according to the following instructions:
5259
</p>
5360
<ol>
@@ -87,14 +94,36 @@ <h3><a id="usage"></a>Usage</h3>
8794
</li>
8895
<li>Click <i>Authenticate</i> below.</li>
8996
</ol>
97+
<p class="text-center p-3">
98+
<button id="webeid-auth-button" class="btn btn-info">Authenticate</button>
99+
</p>
100+
101+
<h4 id="usage-mobile">Web eID for Mobile</h4>
102+
<p>The recommended way of installing Web eID for mobile devices is by installing the
103+
<a href="https://www.id.ee/en/article/install-id-software/">official Web eID mobile application</a>.
104+
</p>
105+
<ol>
106+
<li>Install the <a href="https://www.id.ee/en/article/install-id-software/">Web eID mobile app</a></li>
107+
<li>
108+
Ensure NFC is enabled on your device
109+
<br><small>On Android: Settings → Connections → NFC → enable.<br>
110+
On iOS: NFC is automatically enabled on supported devices.</small>
111+
</li>
112+
</ol>
113+
114+
<p>Testing:</p>
115+
<ol>
116+
<li>Click <i>Authenticate on mobile device</i> below and follow the instructions in the app.</li>
117+
</ol>
118+
119+
<p class="text-center p-3">
120+
<button id="webeid-auth-mobile-button" class="btn btn-info">Authenticate on mobile device</button>
121+
</p>
90122

91123
<div id="error-message" class="alert alert-danger" style="display: none;" role="alert">
92124
<div class="message"></div>
93125
<pre class="details"></pre>
94126
</div>
95-
<p class="text-center p-4">
96-
<button id="webeid-auth-button" class="btn btn-info">Authenticate</button>
97-
</p>
98127

99128
<p>The privacy policy of the test service is available <a href="/files/Web eID privacy policy.pdf">here</a>.
100129
</p>
@@ -121,6 +150,15 @@ <h5>macOS</h5>
121150
<h5>Windows</h5>
122151
<p>Uninstall the Web eID software using <i>Add or remove programs</i>.</p>
123152

153+
<h5>Mobile</h5>
154+
<p>To uninstall the Web eID mobile app, remove it the same way you would uninstall any other app:</p>
155+
<ul>
156+
<li><b>Android:</b> Tap and hold the Web eID app icon, then choose <i>Uninstall</i>, or go to
157+
<i>Settings → Apps → Web eID → Uninstall</i>.</li>
158+
<li><b>iOS:</b> Tap and hold the Web eID app icon until the menu appears, then select <i>Remove App</i>,
159+
and confirm <i>Delete App</i>.</li>
160+
</ul>
161+
124162
<h4><a id="debugging-and-logs"></a>Debugging and logs</h4>
125163
<ul>
126164
<li>
@@ -186,6 +224,16 @@ <h3><a id="documentation"></a>Documentation</h3>
186224
<a href="https://web-eid.github.io/web-eid-cybernetica-analysis/webextensions-main.pdf">in this
187225
document</a>.
188226
</p>
227+
228+
<h4>Mobile</h4>
229+
<p>
230+
Technical overview for mobile of the solution is available in the project
231+
<a href="https://github.com/web-eid/web-eid-for-mobile-architecture-doc">Web eID for Mobile architecture document</a>.
232+
</p>
233+
<p>
234+
The reference Android client implementation can be found here:
235+
<a href="https://github.com/open-eid/RIA-DigiDoc-Android">RIA-DigiDoc-Android</a>.
236+
</p>
189237
<hr/>
190238
<h3><a id="for-developers"></a>For developers</h3>
191239
<p>
@@ -253,6 +301,7 @@ <h3><a id="for-developers"></a>For developers</h3>
253301
hideErrorMessage();
254302

255303
const authButton = document.querySelector("#webeid-auth-button");
304+
const authMobileButton = document.querySelector("#webeid-auth-mobile-button");
256305

257306
const csrfToken = document.querySelector('#csrftoken').content;
258307
const csrfHeaderName = document.querySelector('#csrfheadername').content;
@@ -264,23 +313,7 @@ <h3><a id="for-developers"></a>For developers</h3>
264313
authButton.disabled = true;
265314

266315
try {
267-
if (isMobileDevice()) {
268-
const resp = await fetch("/auth/mobile/init", {
269-
method: "POST",
270-
headers: {
271-
"Content-Type": "application/json",
272-
[csrfHeaderName]: csrfToken,
273-
},
274-
credentials: "include"
275-
});
276-
277-
await checkHttpError(resp);
278-
const { auth_uri } = await resp.json();
279-
window.location.href = auth_uri;
280-
return;
281-
}
282-
283-
const challengeResponse = await fetch("/auth/challenge", {
316+
const challengeResponse = await fetch("/auth/challenge", {
284317
method: "POST",
285318
headers: {
286319
"Content-Type": "application/json",
@@ -316,9 +349,31 @@ <h3><a id="for-developers"></a>For developers</h3>
316349
}
317350
});
318351

319-
function isMobileDevice() {
320-
return /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
321-
}
352+
authMobileButton.addEventListener("click", async () => {
353+
hideErrorMessage();
354+
authMobileButton.disabled = true;
355+
356+
try {
357+
const resp = await fetch("/auth/mobile/init", {
358+
method: "POST",
359+
headers: {
360+
"Content-Type": "application/json",
361+
[csrfHeaderName]: csrfToken,
362+
},
363+
credentials: "include"
364+
});
365+
366+
await checkHttpError(resp);
367+
const { auth_uri } = await resp.json();
368+
window.location.href = auth_uri;
369+
370+
} catch (error) {
371+
showErrorMessage(error);
372+
throw error;
373+
} finally {
374+
authMobileButton.disabled = false;
375+
}
376+
});
322377

323378
document.addEventListener('DOMContentLoaded', function () {
324379
setTimeout(function () {

0 commit comments

Comments
 (0)