Skip to content

Commit

Permalink
✨ Separation of voting session time and bearer token lifetime (#433) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Findeton authored Aug 8, 2024
1 parent 68bb6d6 commit 9691fad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion avAdmin/elections-api-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,13 @@ angular.module('avAdmin')
var deferred = $q.defer();

var cached = electionsapi.permcache[id];
if (!cached) {
var expired = false;
if (cached) {
var decodedToken = Authmethod.decodeToken(cached);
var halfLife = new Date(1000*(decodedToken.create_timestamp + 0.5 * decodedToken.expiry_secs_diff));
expired = halfLife < Date.now();
}
if (!cached || expired) {
Authmethod.getPerm(
"edit|create|register|update|update-share|view|delete|send-auth|send-auth-all|view-results|view-stats|view-voters|view-census|start|stop|allow-tally|tally|calculate-results|publish-results|census-add|census-delete|census-delete-voted|census-activation|add-ballot-boxes|list-ballot-boxes|delete-ballot-boxes|add-tally-sheets|override-tally-sheets|list-tally-sheets|delete-tally-sheets|archive|unarchive|event-view-activity|event-receiver-view-activity|generate-auth-code|reset-voter|suspend|resume|set-public-candidates|set-authenticate-otl-period",
"AuthEvent",
Expand Down

0 comments on commit 9691fad

Please sign in to comment.