Skip to content

Commit

Permalink
feat: removed session token from issue page
Browse files Browse the repository at this point in the history
  • Loading branch information
marnixdessing committed Oct 16, 2022
1 parent 2d5f542 commit 6e0139d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/app/issue/homeRequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async function handleLoggedinRequest(session: Session, brpClient: ApiClient, irm
let irmaSession = {
irmaSessionPtrU: undefined,
irmaSessionPtrQr: undefined,
irmaSessionToken: undefined,
};
if (!brpFailed) {
// Start IRMA session
Expand All @@ -48,7 +47,6 @@ async function handleLoggedinRequest(session: Session, brpClient: ApiClient, irm
} else {
irmaSession.irmaSessionPtrQr = irmaResponse.sessionPtr.irmaqr;
irmaSession.irmaSessionPtrU = irmaResponse.sessionPtr.u;
irmaSession.irmaSessionToken = irmaResponse.token;
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/app/static-resources/static/scripts/issue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const sessionToken = document.getElementById("session-token").value;
const sessionPtrU = document.getElementById("session-ptr-u").value;
const sessionPtrQr = document.getElementById("session-ptr-qr").value;
const irmaServer = document.getElementById("irmaServer").value;
Expand All @@ -9,23 +8,23 @@ const irmaClient = irma.newWeb({
element: '#irma-web-form',
session: {
url: irmaServer,
start: false,
start: false, // No need to start session from the browser (done server-sied)
mapping: {
sessionPtr: r => { return { "u": sessionPtrU, "irmaqr": sessionPtrQr } },
sessionToken: r => { return sessionToken },
},
result: false,
result: false, // No need to fetch session result (status success / failed is sufficient)
},
state: {
serverSentEvents: false,
}
});

irmaClient.start()
.then(() => {
.then(() => { // Hide QR show success message
document.getElementById('irma-form').classList.add("hidden");
document.getElementById('success').classList.remove("hidden");
})
.catch(() => {
.catch(() => { // Hide QR show error message
document.getElementById('irma-form').classList.add("hidden");
document.getElementById('failed-irma').classList.remove("hidden");
});
1 change: 0 additions & 1 deletion src/app/templates/issue.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
<!-- Pass parameters to JS -->
<input id="session-ptr-u" type="hidden" value="{{{irmaSessionPtrU}}}" />
<input id="session-ptr-qr" type="hidden" value="{{{irmaSessionPtrQr}}}" />
<input id="session-token" type="hidden" value="{{{irmaSessionToken}}}" />
<input id="irmaServer" type="hidden" value="{{{irmaServer}}}" />
<input id="sessionResultEndpoint" type="hidden" value="{{{sessionResultEndpoint}}}" />
<!-- Load irma and page JS -->
Expand Down

0 comments on commit 6e0139d

Please sign in to comment.