import type { IncomingMessage, ServerResponse } from 'node:http'; import type { Authenticator } from '../auth/Authenticator'; import type { AuthContext } from '../auth/AuthContext'; /** * Extended request with auth context */ export interface AuthenticatedRequest extends IncomingMessage { auth?: AuthContext; } export interface AuthMiddlewareOptions { authenticator: Authenticator; /** * Paths that do not require authentication */ publicPaths?: string[]; } /** * Middleware that handles authentication for API requests */ export declare class AuthMiddleware { private readonly logger; private readonly authenticator; private readonly publicPaths; constructor(options: AuthMiddlewareOptions); /** * Check if a path is public (does not require authentication) */ isPublicPath(path: string): boolean; /** * Process the request, adding auth context if authenticated * Returns true if request should continue, false if response was sent */ process(request: AuthenticatedRequest, response: ServerResponse): Promise; private sendUnauthorized; private sendAuthFailure; private safeContextForLog; }