/** * Authentication detection utilities for external link validation. * * @file Detects authentication-protected URLs and handles auth-aware validation */ /** Configuration for authentication detection. */ export interface AuthConfig { /** Enable authentication detection */ enabled: boolean; /** API keys/tokens for authenticated requests */ credentials: Record; /** Patterns for recognizing auth-protected domains */ authDomainPatterns: string[]; /** Redirect patterns that indicate authentication requirement */ authRedirectPatterns: string[]; /** Maximum number of redirects to follow */ maxRedirects: number; /** Custom headers for authenticated requests */ customHeaders: Record>; } /** Information about authentication status of a link. */ export interface AuthInfo { /** URL being checked */ url: string; /** Whether link requires authentication */ requiresAuth: boolean; /** Authentication provider if detected */ authProvider?: string; /** Final URL after redirects */ finalUrl?: string; /** Number of redirects followed */ redirectCount: number; /** Whether authentication was attempted */ authAttempted: boolean; /** Whether authentication succeeded */ authSucceeded?: boolean; /** Auth detection method used */ detectionMethod: "domain" | "redirect" | "status-code" | "content" | "none"; /** Warning message if auth-protected */ warning?: string; /** Suggestion for handling auth requirement */ suggestion?: string; } /** Authentication detector for external links. */ export declare class AuthDetector { private config; constructor(config?: Partial); /** Check if authentication detection is enabled. */ isEnabled(): boolean; /** Analyze authentication requirements for a URL. */ analyzeAuth(url: string, response?: Response, redirectHistory?: string[]): AuthInfo; /** Check if URL is from a known auth-protected domain. */ private checkAuthDomain; /** Analyze HTTP response for authentication indicators. */ private analyzeResponse; /** Analyze redirect chain for authentication patterns. */ private analyzeRedirects; /** Check if URL matches an auth domain pattern. */ private matchesPattern; /** Detect authentication provider from domain pattern. */ private detectAuthProvider; /** Detect authentication provider from redirect URL. */ private detectAuthProviderFromUrl; /** Get headers for authenticated request to a specific domain. */ getAuthHeaders(url: string): Record; /** Check if we should attempt authentication for this URL. */ shouldAttemptAuth(url: string): boolean; } /** Default authentication configuration. */ export declare const DEFAULT_AUTH_CONFIG: AuthConfig; //# sourceMappingURL=auth-detection.d.ts.map