Skip to content

Commit

Permalink
Merge pull request #2595 from bcgov/session-idle-remaining
Browse files Browse the repository at this point in the history
feat: idle based on longer of refresh and access token
  • Loading branch information
marcellmueller authored Oct 31, 2023
2 parents 8ccda0e + fa17a5f commit 470050f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/backend/lib/sso-express/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ export const getSessionRemainingTime = (req: Request) => {
return 0;
}
const refreshToken = decodeJwt(req.session.tokenSet.refresh_token);
const accessToken = decodeJwt(req.session.tokenSet.access_token);
if (accessToken.payload.exp > refreshToken.payload.exp) {
return Math.round(accessToken.payload.exp - Date.now() / 1000);
}
return Math.round(refreshToken.payload.exp - Date.now() / 1000);
};

0 comments on commit 470050f

Please sign in to comment.