Browse Source

Feature: update comments in OidcStateStore for clarity

pull/5981/head
Germán Martín 3 weeks ago
parent
commit
9839078b19
  1. 20
      apps/api/src/app/auth/oidc-state.store.ts

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

@ -14,10 +14,8 @@ export class OidcStateStore {
>(); >();
private readonly STATE_EXPIRY_MS = 10 * 60 * 1000; // 10 minutes private readonly STATE_EXPIRY_MS = 10 * 60 * 1000; // 10 minutes
/** // Store request state.
* Store request state. // Signature matches passport-openidconnect SessionStore
* Signature matches passport-openidconnect SessionStore
*/
public store( public store(
_req: unknown, _req: unknown,
ctx: { maxAge?: number; nonce?: string; issued?: Date }, ctx: { maxAge?: number; nonce?: string; issued?: Date },
@ -45,10 +43,8 @@ export class OidcStateStore {
} }
} }
/** // Verify request state.
* Verify request state. // Signature matches passport-openidconnect SessionStore
* Signature matches passport-openidconnect SessionStore
*/
public verify( public verify(
_req: unknown, _req: unknown,
handle: string, handle: string,
@ -80,9 +76,7 @@ export class OidcStateStore {
} }
} }
/** // Generate a cryptographically secure random handle
* Generate a cryptographically secure random handle
*/
private generateHandle(): string { private generateHandle(): string {
return ( return (
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) +
@ -91,9 +85,7 @@ export class OidcStateStore {
); );
} }
/** // Clean up expired states
* Clean up expired states
*/
private cleanup(): void { private cleanup(): void {
const now = Date.now(); const now = Date.now();
const expiredKeys: string[] = []; const expiredKeys: string[] = [];

Loading…
Cancel
Save