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

53 lines 2.17 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; import { All, Controller, Next, Req, Res } from '@nestjs/common'; import { AuthMiddleware } from './auth.middleware.js'; import { Public } from './auth.decorators.js'; /** * Controller that handles all Auth.js routes. * Delegates all requests to AuthMiddleware for processing. */ let AuthController = class AuthController { authMiddleware; constructor(authMiddleware) { this.authMiddleware = authMiddleware; // } /** * Handles all Auth.js routes including * - GET/POST /auth/signin * - GET /auth/callback/:provider * - POST /auth/signout * - GET /auth/session * - etc. */ async handleAuthRoutes(req, res, next) { return this.authMiddleware.use(req, res, next); } }; __decorate([ All('*path'), __param(0, Req()), __param(1, Res()), __param(2, Next()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object, Function]), __metadata("design:returntype", Promise) ], AuthController.prototype, "handleAuthRoutes", null); AuthController = __decorate([ Controller('auth'), Public(), __metadata("design:paramtypes", [AuthMiddleware]) ], AuthController); export { AuthController }; //# sourceMappingURL=auth.controller.js.map