Skip to content
Snippets Groups Projects
Verified Commit 0f4cff5e authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

[web] improve JWT badge in tokeninfo pane

parent dc3b6dd6
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,12 @@
<!-- ### Dependencies -->
<!-- -->
## mytoken 0.10.0
### Enhancements
- In the tokeninfo pane in the webinterface expires JWTs now get a more precise badge.
## mytoken 0.9.1
### Enhancements
......
......@@ -13,6 +13,9 @@
<span class="ml-2 badge badge-pill badge-danger tokeninfo-token-type d-none"
id="tokeninfo-token-type-JWT-invalid"
data-toggle="tooltip" data-placement="top" title="Signature invalid">JWT</span>
<span class="ml-2 badge badge-pill badge-warning tokeninfo-token-type d-none"
id="tokeninfo-token-type-JWT-exp"
data-toggle="tooltip" data-placement="top" title="Signature valid, token expired">JWT</span>
<span class="ml-2 badge badge-pill badge-success" id="tokeninfo-token-valid"
data-toggle="tooltip" data-placement="top" title="Mytoken is valid and can be used">
......
......@@ -4,6 +4,7 @@ const $tokeninfoBadgeName = $('#tokeninfo-token-name');
const $tokeninfoBadgeTypeShort = $('#tokeninfo-token-type-short');
const $tokeninfoBadgeTypeJWTValid = $('#tokeninfo-token-type-JWT-valid');
const $tokeninfoBadgeTypeJWTInvalid = $('#tokeninfo-token-type-JWT-invalid');
const $tokeninfoBadgeTypeJWTExpired = $('#tokeninfo-token-type-JWT-exp');
const $tokeninfoBadgeValid = $('#tokeninfo-token-valid');
const $tokeninfoBadgeInvalid = $('#tokeninfo-token-invalid');
const $tokeninfoBadgeMytokenIss = $('#tokeninfo-token-mytoken-iss');
......@@ -54,6 +55,7 @@ async function update_tokeninfo() {
let mytokenIss = payload['iss'];
$tokeninfoTypeBadges.hideB();
$tokeninfoBadgeTypeJWTInvalid.showB();
$tokeninfoBadgeTypeJWTExpired.hideB();
if (mytokenIss.endsWith("/")) {
mytokenIss = mytokenIss.substring(0, mytokenIss.length - 1);
}
......@@ -80,6 +82,10 @@ async function update_tokeninfo() {
if (e instanceof jose.errors.JWTInvalid) {
$tokeninfoTypeBadges.hideB();
$tokeninfoBadgeTypeShort.showB();
}
if (e instanceof jose.errors.JWTExpired) {
$tokeninfoBadgeTypeJWTInvalid.hideB();
$tokeninfoBadgeTypeJWTExpired.showB();
} else {
console.error(e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment