import type { NextFunction, Response } from 'express'; import type { AppUser } from '../../../models/User.ts'; import type { FrameworkRequest } from '../HttpServer.ts'; import AbstractMiddleware from './AbstractMiddleware.ts'; export interface GetUserByTokenAppInfo { appInfo: { user?: AppUser; }; } declare class GetUserByToken extends AbstractMiddleware { static get description(): string; /** * Type-only phantom: declares what this middleware contributes to * `req.appInfo`. Codegen reads this to type per-route `Request`; * runtime ignores it. The returned object is always `{}` — only the cast * type matters. */ static get provides(): { user?: AppUser; }; static get authSchemes(): ({ name: string; type: string; in: string; description: string; scheme?: undefined; } | { in?: undefined; name: string; type: string; scheme: string; description: string; })[]; get usedAuthParameters(): ({ name: string; type: string; in: string; description: string; scheme?: undefined; } | { in?: undefined; name: string; type: string; scheme: string; description: string; })[]; /** * Resolve the bearer token a request presents, applying the auth precedence: * body `token` first, then the `Authorization` header. A literal `'null'` * header value counts as absent. The `Bearer` prefix is stripped and the * result trimmed. Returns `undefined` when no token is present. Shared with * `postLogout` so both revoke the exact session the request authenticated with. */ static resolveToken(req: FrameworkRequest): string | undefined; middleware(req: FrameworkRequest & GetUserByTokenAppInfo, _res: Response, next: NextFunction): Promise; } export default GetUserByToken;