UNPKG

@next-nest-auth/nestauth

Version:

NestAuth is an authentication solution for NestJS applications, designed to handle user login, session management, and token-based authentication (JWT). It integrates seamlessly with Next.js and other frontends to provide a unified authentication system,

76 lines 3.45 kB
"use strict"; 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 NestAuthModule_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.NestAuthModule = void 0; const common_1 = require("@nestjs/common"); const config_1 = require("@nestjs/config"); const nestauth_service_1 = require("./nestauth.service"); const nestauth_controller_1 = require("./nestauth.controller"); const passport_1 = require("@nestjs/passport"); const jwt_1 = require("@nestjs/jwt"); const nestauth_jwt_strategy_1 = require("./nestauth-jwt.strategy"); const nestauth_local_strategy_1 = require("./nestauth-local.strategy"); const nestauth_google_strategy_1 = require("./nestauth-google.strategy"); const nestauth_facebook_strategy_1 = require("./nestauth-facebook.strategy"); let NestAuthModule = NestAuthModule_1 = class NestAuthModule { static register(options) { const UserServiceProvider = { provide: "UserService", useExisting: options.UserService, }; const JwtSecretProvider = { provide: "JWT_SECRET", useValue: options.jwtSecret || "60s", }; const JwtExpiresInProvider = { provide: "JWT_EXPIRES_IN", useValue: options.jwtExpiresIn, }; const JwtRefreshTokenExpiresInProvider = { provide: "JWT_REFRESH_TOKEN_EXPIRES_IN", useValue: options.jwtRefreshTokenExpiresIn, }; return { module: NestAuthModule_1, imports: [ jwt_1.JwtModule.registerAsync({ imports: [], inject: [], useFactory: async () => ({ secret: options.jwtSecret, signOptions: { expiresIn: options.jwtExpiresIn, }, }), }), (0, common_1.forwardRef)(() => options.UserModule), ], providers: [ nestauth_service_1.NestAuthService, UserServiceProvider, nestauth_jwt_strategy_1.NestAuthJwtStrategy, nestauth_local_strategy_1.NestAuthLocalStrategy, nestauth_google_strategy_1.NestAuthGoogleStrategy, nestauth_facebook_strategy_1.NestAuthFacebookStrategy, JwtSecretProvider, JwtExpiresInProvider, JwtRefreshTokenExpiresInProvider, ], exports: [nestauth_service_1.NestAuthService], controllers: [nestauth_controller_1.NestAuthController], }; } }; exports.NestAuthModule = NestAuthModule; exports.NestAuthModule = NestAuthModule = NestAuthModule_1 = __decorate([ (0, common_1.Module)({ imports: [passport_1.PassportModule, config_1.ConfigModule.forRoot({})], }) ], NestAuthModule); //# sourceMappingURL=nestauth.module.js.map