/** * OIDC session stored during the authorization flow * * Temporary session that exists only during the OAuth/OIDC flow (typically 10 minutes). * Used for CSRF protection (state), PKCE (codeVerifier), and replay protection (nonce). */ export default interface OidcSession { /** * MongoDB document ID */ _id?: string; /** * Unique session identifier */ sessionId: string; /** * CSRF protection token * Random value used to prevent cross-site request forgery attacks */ state: string; /** * PKCE code verifier * Secret value used to prove the client initiated the authorization request */ codeVerifier: string; /** * Nonce for ID token validation * Random value used to prevent replay attacks on the ID token */ nonce: string; /** * Provider name (e.g., "acme", "contoso") */ provider: string; /** * URL to redirect to after successful authentication * Can be overridden by the client via query parameter */ redirectUri: string; /** * Session creation timestamp * MongoDB TTL index will automatically delete expired sessions */ createdAt: Date; }