Merge pull request #3849 from erikxiv/fix/token-expiration-bug

fix: id token expiration in s, not ms
This commit is contained in:
Fredrik Adelöw
2020-12-27 11:32:28 +01:00
committed by GitHub
3 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---
fix bug in token expiration date
@@ -87,7 +87,7 @@ describe('TokenFactory', () => {
iat: expect.any(Number),
exp: expect.any(Number),
});
expect(payload.exp).toBe(payload.iat + keyDurationSeconds * 1000);
expect(payload.exp).toBe(payload.iat + keyDurationSeconds);
});
it('should generate new signing keys when the current one expires', async () => {
@@ -69,7 +69,7 @@ export class TokenFactory implements TokenIssuer {
const sub = params.claims.sub;
const aud = 'backstage';
const iat = Math.floor(Date.now() / MS_IN_S);
const exp = iat + this.keyDurationSeconds * MS_IN_S;
const exp = iat + this.keyDurationSeconds;
this.logger.info(`Issuing token for ${sub}`);