Merge pull request #3849 from erikxiv/fix/token-expiration-bug
fix: id token expiration in s, not ms
This commit is contained in:
@@ -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}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user