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

Loading…
Cancel
Save