/// import { Request } from '@loopback/rest'; import { FlclLoggerLb4 } from 'fc-logger'; import { ErrorResponseConfig, LoggingConfig, SecurityEvent } from '../types'; import { SecurityError } from './security-error'; /** * Security logger utility for centralized logging of security events */ export declare class SecurityLogger { private config?; private logger?; private errorResponseConfig?; constructor(config?: LoggingConfig | undefined, logger?: FlclLoggerLb4 | undefined, errorResponseConfig?: ErrorResponseConfig | undefined); /** * Log a security event */ logSecurityEvent(req: Request | Record, event: SecurityEvent, className?: string, methodName?: string): void; /** * Log security violation with high priority */ logSecurityViolation(req: Request | Record, error: Error | string, metadata?: Record, className?: string, methodName?: string): void; /** * Log malicious activity detection */ logMaliciousActivity(req: Request | Record, activityType: string, details: string, metadata?: Record, className?: string, methodName?: string): void; /** * Enrich event with request details */ private enrichEvent; /** * Check if object is a Request */ private isRequest; /** * Mask sensitive data in the event */ private maskSensitiveData; /** * Determine if event should be logged based on configuration */ private shouldLogEvent; /** * Get appropriate log level for event */ private getEventLogLevel; /** * Convert log level to numeric value for comparison */ private getLogLevelValue; /** * Log using FlclLogger */ private logWithFlclLogger; /** * Log using console (fallback) */ private logWithConsole; /** * Handle SecurityError - logs detailed information internally and returns safe public response */ handleSecurityError(req: Request, error: SecurityError): { shouldLog: boolean; publicResponse: Record; loggedDetails: Record; }; /** * Generic method to handle any error safely */ handleGenericError(req: Request, error: unknown, fallbackMessage?: string): { shouldLog: boolean; publicResponse: Record; loggedDetails: Record; }; /** * Update logger configuration */ updateConfig(config: Partial): void; /** * Get current configuration */ getConfig(): LoggingConfig | undefined; }