UNPKG

@mridang/nestjs-auth

Version:

A comprehensive Auth.js integration for NestJS applications with TypeScript support, framework-agnostic HTTP adapters, and role-based access control

18 lines (17 loc) 886 B
import { NestMiddleware } from '@nestjs/common'; import { HttpAdapterHost } from '@nestjs/core'; import type { IAuthModuleOptions } from './auth-module.options.js'; import type { Request as ExpressRequest, Response as ExpressResponse } from 'express'; import type { FastifyReply, FastifyRequest } from 'fastify'; /** * Middleware that intercepts requests to Auth.js routes and processes * them through Auth.js core. Handles all authentication flows including * sign-in, sign-out, callbacks, and session management. */ export declare class AuthMiddleware implements NestMiddleware { private readonly options; private readonly adapterHost; private httpAdapter?; constructor(options: IAuthModuleOptions, adapterHost: HttpAdapterHost); use(req: FastifyRequest | ExpressRequest, res: FastifyReply | ExpressResponse, next: (error?: unknown) => void): Promise<void>; }