import { ApplicationLoggerService } from "@neoma/logging"; import { NestMiddleware } from "@nestjs/common"; import { Request, NextFunction } from "express"; import { AuthenticationService } from "../services/authentication.service"; /** * Middleware that attempts to authenticate the request using a Bearer token * in the Authorization header. If authentication is successful, the * authenticated principal is assigned to req.principal. * * If req.principal is already set (by a previous middleware), this * middleware skips authentication and calls next. * * If no Authorization header is present, the request proceeds * unauthenticated without error. * * If an Authorization header is present but malformed (wrong scheme, * missing token), an InvalidCredentialsException is thrown. * * If the header is well-formed but authentication fails (invalid JWT, * expired token, user not found), no principal is assigned and the * request proceeds unauthenticated with a warning logged. */ export declare class BearerAuthenticationMiddleware implements NestMiddleware { private readonly service; private readonly logger; constructor(service: AuthenticationService, logger: ApplicationLoggerService); use(req: Request, _res: Express.Response, next: NextFunction): Promise; }