Browse Source

Format code

pull/7797/head
Thomas Kaul 1 month ago
parent
commit
6d2feebfdf
  1. 10
      apps/api/src/app/auth/oidc-state.store.ts

10
apps/api/src/app/auth/oidc-state.store.ts

@ -1,6 +1,6 @@
import type { Request } from 'express';
import ms from 'ms';
import { randomBytes } from 'node:crypto'; // ADD THIS LINE
import { randomBytes } from 'node:crypto';
import type {
SessionStore,
SessionStoreCallback,
@ -72,16 +72,16 @@ export class OidcStateStore implements SessionStore {
undefined,
undefined
);
}
}
if (Date.now() - data.timestamp > this.STATE_EXPIRY_MS) {
if (Date.now() - data.timestamp > this.STATE_EXPIRY_MS) {
this.stateMap.delete(handle);
return callback(
new Error('OIDC state has expired, please try again'),
undefined,
undefined
);
}
}
// Remove state after verification (one-time use)
this.stateMap.delete(handle);
@ -115,5 +115,5 @@ if (Date.now() - data.timestamp > this.STATE_EXPIRY_MS) {
*/
private generateHandle() {
return randomBytes(32).toString('hex');
}
}
}

Loading…
Cancel
Save