@next-nest-auth/nestauth 1.2.5 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { Profile, Strategy } from "passport-facebook";
2
- declare const NestAuthFacebookStrategy_base: new (...args: [options: import("passport-facebook").StrategyOptions] | [options: import("passport-facebook").StrategyOptionsWithRequest]) => Strategy & {
2
+ declare const NestAuthFacebookStrategy_base: new (...args: [options: import("passport-facebook").StrategyOptionsWithRequest] | [options: import("passport-facebook").StrategyOptions]) => Strategy & {
3
3
  validate(...args: any[]): unknown;
4
4
  };
5
5
  export declare class NestAuthFacebookStrategy extends NestAuthFacebookStrategy_base {
@@ -1,5 +1,5 @@
1
1
  import { Strategy, Profile, VerifyCallback } from "passport-google-oauth20";
2
- declare const NestAuthGoogleStrategy_base: new (...args: [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptionsWithRequest] | [options: import("passport-google-oauth20").StrategyOptionsWithRequest]) => Strategy & {
2
+ declare const NestAuthGoogleStrategy_base: new (...args: [options: import("passport-google-oauth20").StrategyOptionsWithRequest] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptionsWithRequest]) => Strategy & {
3
3
  validate(...args: any[]): unknown;
4
4
  };
5
5
  export declare class NestAuthGoogleStrategy extends NestAuthGoogleStrategy_base {
@@ -1,4 +1,20 @@
1
- declare const NestAuthLocalGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
2
- export declare class NestAuthLocalGuard extends NestAuthLocalGuard_base {
3
- }
4
- export {};
1
+ export declare function createLocalGuard(strategyName: string): {
2
+ new (...args: any[]): {
3
+ canActivate(context: import("@nestjs/common").ExecutionContext): boolean | Promise<boolean> | import("rxjs").Observable<boolean>;
4
+ logIn<TRequest extends {
5
+ logIn: Function;
6
+ } = any>(request: TRequest): Promise<void>;
7
+ handleRequest<TUser = any>(err: any, user: any, info: any, context: import("@nestjs/common").ExecutionContext, status?: any): TUser;
8
+ getAuthenticateOptions(context: import("@nestjs/common").ExecutionContext): import("@nestjs/passport").IAuthModuleOptions | undefined;
9
+ getRequest(context: import("@nestjs/common").ExecutionContext): any;
10
+ };
11
+ apply(this: Function, thisArg: any, argArray?: any): any;
12
+ call(this: Function, thisArg: any, ...argArray: any[]): any;
13
+ bind(this: Function, thisArg: any, ...argArray: any[]): any;
14
+ toString(): string;
15
+ readonly length: number;
16
+ arguments: any;
17
+ caller: Function;
18
+ readonly name: string;
19
+ [Symbol.hasInstance](value: any): boolean;
20
+ };
@@ -6,13 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.NestAuthLocalGuard = void 0;
9
+ exports.createLocalGuard = createLocalGuard;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const passport_1 = require("@nestjs/passport");
12
- let NestAuthLocalGuard = class NestAuthLocalGuard extends (0, passport_1.AuthGuard)("nestauth-local") {
13
- };
14
- exports.NestAuthLocalGuard = NestAuthLocalGuard;
15
- exports.NestAuthLocalGuard = NestAuthLocalGuard = __decorate([
16
- (0, common_1.Injectable)()
17
- ], NestAuthLocalGuard);
12
+ function createLocalGuard(strategyName) {
13
+ let NestAuthLocalGuard = class NestAuthLocalGuard extends (0, passport_1.AuthGuard)(strategyName) {
14
+ };
15
+ NestAuthLocalGuard = __decorate([
16
+ (0, common_1.Injectable)()
17
+ ], NestAuthLocalGuard);
18
+ return NestAuthLocalGuard;
19
+ }
18
20
  //# sourceMappingURL=nestauth-local.guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nestauth-local.guard.js","sourceRoot":"","sources":["../src/nestauth-local.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,IAAA,oBAAS,EAAC,gBAAgB,CAAC;CAAG,CAAA;AAAzD,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;GACA,kBAAkB,CAAuC"}
1
+ {"version":3,"file":"nestauth-local.guard.js","sourceRoot":"","sources":["../src/nestauth-local.guard.ts"],"names":[],"mappings":";;;;;;;;AAMA,4CAKC;AAXD,2CAA4C;AAC5C,+CAA6C;AAK7C,SAAgB,gBAAgB,CAAC,YAAoB;IAEjD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,IAAA,oBAAS,EAAC,YAAY,CAAC;KAAG,CAAA;IAArD,kBAAkB;QADvB,IAAA,mBAAU,GAAE;OACP,kBAAkB,CAAmC;IAE3D,OAAO,kBAAkB,CAAC;AAC9B,CAAC"}
@@ -1,11 +1,14 @@
1
- import { Strategy } from "passport-custom";
2
1
  import { NestAuthInterface } from "./nestauth.interface";
3
- declare const NestAuthLocalStrategy_base: new () => Strategy & {
4
- validate(...args: any[]): unknown;
2
+ export declare function createLocalStrategy(strategyName: string, userServiceToken: string): {
3
+ new (userService: NestAuthInterface): {
4
+ readonly userService: NestAuthInterface;
5
+ validate(req: Request): Promise<any>;
6
+ authenticate(req: import("express").Request, options?: any): any;
7
+ success(user: any, info?: any): void;
8
+ fail(challenge: any, status: number): void;
9
+ fail(status: number): void;
10
+ redirect(url: string, status?: number): void;
11
+ pass(): void;
12
+ error(err: Error): void;
13
+ };
5
14
  };
6
- export declare class NestAuthLocalStrategy extends NestAuthLocalStrategy_base {
7
- private readonly userService;
8
- constructor(userService: NestAuthInterface);
9
- validate(req: Request): Promise<any>;
10
- }
11
- export {};
@@ -12,29 +12,31 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.NestAuthLocalStrategy = void 0;
15
+ exports.createLocalStrategy = createLocalStrategy;
16
16
  const passport_1 = require("@nestjs/passport");
17
17
  const passport_custom_1 = require("passport-custom");
18
18
  const common_1 = require("@nestjs/common");
19
19
  const macaddress = require("macaddress");
20
- let NestAuthLocalStrategy = class NestAuthLocalStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, "nestauth-local") {
21
- constructor(userService) {
22
- super();
23
- this.userService = userService;
24
- }
25
- async validate(req) {
26
- const user = await this.userService.validateUser(req.body);
27
- if (!user) {
28
- throw new common_1.UnauthorizedException("Invalid credentials");
20
+ function createLocalStrategy(strategyName, userServiceToken) {
21
+ let NestAuthLocalStrategy = class NestAuthLocalStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, strategyName) {
22
+ constructor(userService) {
23
+ super();
24
+ this.userService = userService;
29
25
  }
30
- user.macId = await macaddress.one();
31
- return user;
32
- }
33
- };
34
- exports.NestAuthLocalStrategy = NestAuthLocalStrategy;
35
- exports.NestAuthLocalStrategy = NestAuthLocalStrategy = __decorate([
36
- (0, common_1.Injectable)(),
37
- __param(0, (0, common_1.Inject)("UserService")),
38
- __metadata("design:paramtypes", [Object])
39
- ], NestAuthLocalStrategy);
26
+ async validate(req) {
27
+ const user = await this.userService.validateUser(req.body);
28
+ if (!user) {
29
+ throw new common_1.UnauthorizedException("Invalid credentials");
30
+ }
31
+ user.macId = await macaddress.one();
32
+ return user;
33
+ }
34
+ };
35
+ NestAuthLocalStrategy = __decorate([
36
+ (0, common_1.Injectable)(),
37
+ __param(0, (0, common_1.Inject)(userServiceToken)),
38
+ __metadata("design:paramtypes", [Object])
39
+ ], NestAuthLocalStrategy);
40
+ return NestAuthLocalStrategy;
41
+ }
40
42
  //# sourceMappingURL=nestauth-local.strategy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nestauth-local.strategy.js","sourceRoot":"","sources":["../src/nestauth-local.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+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,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;gBACR,MAAM,IAAI,8BAAqB,CAAC,qBAAqB,CAAC,CAAC;YAC3D,CAAC;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QAChB,CAAC;KACJ,CAAA;IAnBK,qBAAqB;QAD1B,IAAA,mBAAU,GAAE;QAMJ,WAAA,IAAA,eAAM,EAAC,gBAAgB,CAAC,CAAA;;OAL3B,qBAAqB,CAmB1B;IAED,OAAO,qBAAqB,CAAC;AACjC,CAAC"}
@@ -1,15 +1,16 @@
1
1
  import { NestAuthService } from "./nestauth.service";
2
- export declare class NestAuthController {
3
- private readonly nestAuthService;
4
- constructor(nestAuthService: NestAuthService);
5
- greetings(): Promise<string>;
6
- login(req: any): Promise<any>;
7
- refreshToken(params: {
8
- refresh_token: string;
9
- }): Promise<any>;
10
- googleAuth(req: any): Promise<any>;
11
- googleAuthRedirect(req: any): Promise<any>;
12
- facebookLogin(): Promise<any>;
13
- facebookLoginRedirect(req: any): Promise<any>;
14
- logout(req: any): Promise<any>;
15
- }
2
+ export declare function createDynamicController(prefix: string, nestAuthServiceToken: string, localGuard: any): {
3
+ new (nestAuthService: NestAuthService): {
4
+ readonly nestAuthService: NestAuthService;
5
+ greetings(): Promise<string>;
6
+ login(req: any): Promise<any>;
7
+ refreshToken(params: {
8
+ refresh_token: string;
9
+ }): Promise<any>;
10
+ googleAuth(req: any): Promise<any>;
11
+ googleAuthRedirect(req: any): Promise<any>;
12
+ facebookLogin(): Promise<any>;
13
+ facebookLoginRedirect(req: any): Promise<any>;
14
+ logout(req: any): Promise<any>;
15
+ };
16
+ };
@@ -12,106 +12,116 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.NestAuthController = void 0;
15
+ exports.createDynamicController = createDynamicController;
16
16
  const common_1 = require("@nestjs/common");
17
- const nestauth_local_guard_1 = require("./nestauth-local.guard");
17
+ const nestauth_service_1 = require("./nestauth.service");
18
18
  const nestauth_google_guard_1 = require("./nestauth-google.guard");
19
19
  const nestauth_facebook_guard_1 = require("./nestauth-facebook.guard");
20
- class NestAuthController {
21
- constructor(nestAuthService) {
22
- this.nestAuthService = nestAuthService;
23
- }
24
- async greetings() {
25
- return "Welcome to NestAuth. Please check our documentation for more information.";
26
- }
27
- async login(req) {
28
- return this.nestAuthService.login(req.user);
29
- }
30
- refreshToken(params) {
31
- if (!params.refresh_token) {
32
- throw new common_1.BadRequestException("Invalid or expired refresh token");
20
+ const http_exception_filter_1 = require("./http-exception.filter");
21
+ function createDynamicController(prefix, nestAuthServiceToken, localGuard) {
22
+ let NestAuthController = class NestAuthController {
23
+ constructor(nestAuthService) {
24
+ this.nestAuthService = nestAuthService;
33
25
  }
34
- return this.nestAuthService.refreshToken(params.refresh_token);
35
- }
36
- async googleAuth(req) { }
37
- googleAuthRedirect(req) {
38
- if (!req.user) {
39
- throw new common_1.UnauthorizedException("Unable to login with Google");
26
+ async greetings() {
27
+ return "Welcome to NestAuth. Please check our documentation for more information.";
40
28
  }
41
- return this.nestAuthService.google(req.user);
42
- }
43
- async facebookLogin() {
44
- return common_1.HttpStatus.OK;
45
- }
46
- async facebookLoginRedirect(req) {
47
- if (!req.user) {
48
- throw new common_1.UnauthorizedException("Unable to login with Facebook");
29
+ async login(req) {
30
+ console.log("nestAuthServiceToken", nestAuthServiceToken);
31
+ return this.nestAuthService.login(req.user);
49
32
  }
50
- return this.nestAuthService.facebook(req.user);
51
- }
52
- async logout(req) {
53
- return req.logout();
54
- }
33
+ refreshToken(params) {
34
+ if (!params.refresh_token) {
35
+ throw new common_1.BadRequestException("Invalid or expired refresh token");
36
+ }
37
+ return this.nestAuthService.refreshToken(params.refresh_token);
38
+ }
39
+ async googleAuth(req) { }
40
+ googleAuthRedirect(req) {
41
+ if (!req.user) {
42
+ throw new common_1.UnauthorizedException("Unable to login with Google");
43
+ }
44
+ return this.nestAuthService.google(req.user);
45
+ }
46
+ async facebookLogin() {
47
+ return common_1.HttpStatus.OK;
48
+ }
49
+ async facebookLoginRedirect(req) {
50
+ if (!req.user) {
51
+ throw new common_1.UnauthorizedException("Unable to login with Facebook");
52
+ }
53
+ return this.nestAuthService.facebook(req.user);
54
+ }
55
+ async logout(req) {
56
+ return req.logout();
57
+ }
58
+ };
59
+ __decorate([
60
+ (0, common_1.All)(),
61
+ __metadata("design:type", Function),
62
+ __metadata("design:paramtypes", []),
63
+ __metadata("design:returntype", Promise)
64
+ ], NestAuthController.prototype, "greetings", null);
65
+ __decorate([
66
+ (0, common_1.UseGuards)(localGuard),
67
+ (0, common_1.Post)("login"),
68
+ __param(0, (0, common_1.Request)()),
69
+ __metadata("design:type", Function),
70
+ __metadata("design:paramtypes", [Object]),
71
+ __metadata("design:returntype", Promise)
72
+ ], NestAuthController.prototype, "login", null);
73
+ __decorate([
74
+ (0, common_1.Post)("refresh-token"),
75
+ __param(0, (0, common_1.Body)()),
76
+ __metadata("design:type", Function),
77
+ __metadata("design:paramtypes", [Object]),
78
+ __metadata("design:returntype", Promise)
79
+ ], NestAuthController.prototype, "refreshToken", null);
80
+ __decorate([
81
+ (0, common_1.UseGuards)(nestauth_google_guard_1.NestAuthGoogleGuard),
82
+ (0, common_1.Get)("google"),
83
+ __param(0, (0, common_1.Request)()),
84
+ __metadata("design:type", Function),
85
+ __metadata("design:paramtypes", [Object]),
86
+ __metadata("design:returntype", Promise)
87
+ ], NestAuthController.prototype, "googleAuth", null);
88
+ __decorate([
89
+ (0, common_1.Get)("google-redirect"),
90
+ (0, common_1.UseGuards)(nestauth_google_guard_1.NestAuthGoogleGuard),
91
+ __param(0, (0, common_1.Request)()),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [Object]),
94
+ __metadata("design:returntype", void 0)
95
+ ], NestAuthController.prototype, "googleAuthRedirect", null);
96
+ __decorate([
97
+ (0, common_1.Get)("/facebook"),
98
+ (0, common_1.UseGuards)(nestauth_facebook_guard_1.NestAuthFacebookGuard),
99
+ __metadata("design:type", Function),
100
+ __metadata("design:paramtypes", []),
101
+ __metadata("design:returntype", Promise)
102
+ ], NestAuthController.prototype, "facebookLogin", null);
103
+ __decorate([
104
+ (0, common_1.Get)("/facebook-redirect"),
105
+ (0, common_1.UseGuards)(nestauth_facebook_guard_1.NestAuthFacebookGuard),
106
+ __param(0, (0, common_1.Request)()),
107
+ __metadata("design:type", Function),
108
+ __metadata("design:paramtypes", [Object]),
109
+ __metadata("design:returntype", Promise)
110
+ ], NestAuthController.prototype, "facebookLoginRedirect", null);
111
+ __decorate([
112
+ (0, common_1.UseGuards)(localGuard),
113
+ (0, common_1.Get)("logout"),
114
+ __param(0, (0, common_1.Request)()),
115
+ __metadata("design:type", Function),
116
+ __metadata("design:paramtypes", [Object]),
117
+ __metadata("design:returntype", Promise)
118
+ ], NestAuthController.prototype, "logout", null);
119
+ NestAuthController = __decorate([
120
+ (0, common_1.UseFilters)(http_exception_filter_1.HttpExceptionFilter),
121
+ (0, common_1.Controller)(prefix),
122
+ __param(0, (0, common_1.Inject)(nestAuthServiceToken)),
123
+ __metadata("design:paramtypes", [nestauth_service_1.NestAuthService])
124
+ ], NestAuthController);
125
+ return NestAuthController;
55
126
  }
56
- exports.NestAuthController = NestAuthController;
57
- __decorate([
58
- (0, common_1.Get)(),
59
- __metadata("design:type", Function),
60
- __metadata("design:paramtypes", []),
61
- __metadata("design:returntype", Promise)
62
- ], NestAuthController.prototype, "greetings", null);
63
- __decorate([
64
- (0, common_1.UseGuards)(nestauth_local_guard_1.NestAuthLocalGuard),
65
- (0, common_1.Post)("login"),
66
- __param(0, (0, common_1.Request)()),
67
- __metadata("design:type", Function),
68
- __metadata("design:paramtypes", [Object]),
69
- __metadata("design:returntype", Promise)
70
- ], NestAuthController.prototype, "login", null);
71
- __decorate([
72
- (0, common_1.Post)("refresh-token"),
73
- __param(0, (0, common_1.Body)()),
74
- __metadata("design:type", Function),
75
- __metadata("design:paramtypes", [Object]),
76
- __metadata("design:returntype", Promise)
77
- ], NestAuthController.prototype, "refreshToken", null);
78
- __decorate([
79
- (0, common_1.UseGuards)(nestauth_google_guard_1.NestAuthGoogleGuard),
80
- (0, common_1.Get)("google"),
81
- __param(0, (0, common_1.Request)()),
82
- __metadata("design:type", Function),
83
- __metadata("design:paramtypes", [Object]),
84
- __metadata("design:returntype", Promise)
85
- ], NestAuthController.prototype, "googleAuth", null);
86
- __decorate([
87
- (0, common_1.Get)("google-redirect"),
88
- (0, common_1.UseGuards)(nestauth_google_guard_1.NestAuthGoogleGuard),
89
- __param(0, (0, common_1.Request)()),
90
- __metadata("design:type", Function),
91
- __metadata("design:paramtypes", [Object]),
92
- __metadata("design:returntype", void 0)
93
- ], NestAuthController.prototype, "googleAuthRedirect", null);
94
- __decorate([
95
- (0, common_1.Get)("/facebook"),
96
- (0, common_1.UseGuards)(nestauth_facebook_guard_1.NestAuthFacebookGuard),
97
- __metadata("design:type", Function),
98
- __metadata("design:paramtypes", []),
99
- __metadata("design:returntype", Promise)
100
- ], NestAuthController.prototype, "facebookLogin", null);
101
- __decorate([
102
- (0, common_1.Get)("/facebook-redirect"),
103
- (0, common_1.UseGuards)(nestauth_facebook_guard_1.NestAuthFacebookGuard),
104
- __param(0, (0, common_1.Request)()),
105
- __metadata("design:type", Function),
106
- __metadata("design:paramtypes", [Object]),
107
- __metadata("design:returntype", Promise)
108
- ], NestAuthController.prototype, "facebookLoginRedirect", null);
109
- __decorate([
110
- (0, common_1.UseGuards)(nestauth_local_guard_1.NestAuthLocalGuard),
111
- (0, common_1.Get)("logout"),
112
- __param(0, (0, common_1.Request)()),
113
- __metadata("design:type", Function),
114
- __metadata("design:paramtypes", [Object]),
115
- __metadata("design:returntype", Promise)
116
- ], NestAuthController.prototype, "logout", null);
117
127
  //# sourceMappingURL=nestauth.controller.js.map
@@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ED,OAAO,kBAAkB,CAAC;AAC9B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule } from "@nestjs/common";
2
2
  import { NestAuthModuleOptions } from "./nestauth.interface";
3
3
  export declare class NestAuthModule {
4
- static register(options: NestAuthModuleOptions): DynamicModule;
4
+ static forRoot(options: NestAuthModuleOptions): DynamicModule;
5
5
  }
@@ -5,12 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  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;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
8
  var NestAuthModule_1;
15
9
  Object.defineProperty(exports, "__esModule", { value: true });
16
10
  exports.NestAuthModule = void 0;
@@ -21,29 +15,39 @@ const nestauth_controller_1 = require("./nestauth.controller");
21
15
  const passport_1 = require("@nestjs/passport");
22
16
  const jwt_1 = require("@nestjs/jwt");
23
17
  const nestauth_jwt_strategy_1 = require("./nestauth-jwt.strategy");
24
- const nestauth_local_strategy_1 = require("./nestauth-local.strategy");
25
18
  const nestauth_google_strategy_1 = require("./nestauth-google.strategy");
26
19
  const nestauth_facebook_strategy_1 = require("./nestauth-facebook.strategy");
27
- const http_exception_filter_1 = require("./http-exception.filter");
20
+ const nestauth_local_strategy_1 = require("./nestauth-local.strategy");
21
+ const nestauth_local_guard_1 = require("./nestauth-local.guard");
28
22
  let NestAuthModule = NestAuthModule_1 = class NestAuthModule {
29
- static register(options) {
30
- const moduleId = options.routePrefix || "default";
31
- const AUTH_SERVICE_TOKEN = Symbol(`NestAuthService_${moduleId}`);
32
- const USER_SERVICE_TOKEN = Symbol(`UserService_${moduleId}`);
23
+ static forRoot(options) {
24
+ const JwtSecretProvider = {
25
+ provide: "JWT_SECRET",
26
+ useValue: options.jwtSecret || "60s",
27
+ };
28
+ const JwtExpiresInProvider = {
29
+ provide: "JWT_EXPIRES_IN",
30
+ useValue: options.jwtExpiresIn,
31
+ };
32
+ const JwtRefreshTokenExpiresInProvider = {
33
+ provide: "JWT_REFRESH_TOKEN_EXPIRES_IN",
34
+ useValue: options.jwtRefreshTokenExpiresIn,
35
+ };
33
36
  const controllerPath = options.routePrefix
34
37
  ? `${options.routePrefix.replace(/^\/|\/$/g, "")}/nestauth`
35
38
  : "nestauth";
36
- let DynamicNestAuthController = class DynamicNestAuthController extends nestauth_controller_1.NestAuthController {
37
- constructor(nestAuthService) {
38
- super(nestAuthService);
39
- }
40
- };
41
- DynamicNestAuthController = __decorate([
42
- (0, common_1.UseFilters)(http_exception_filter_1.HttpExceptionFilter),
43
- (0, common_1.Controller)(controllerPath),
44
- __param(0, (0, common_1.Inject)(AUTH_SERVICE_TOKEN)),
45
- __metadata("design:paramtypes", [nestauth_service_1.NestAuthService])
46
- ], DynamicNestAuthController);
39
+ const pathKey = controllerPath.replaceAll("/", "_").toUpperCase();
40
+ const userServiceToken = `NEST_AUTH_USER_SERVICE_${pathKey}`;
41
+ const nestAuthServiceToken = `NEST_AUTH_SERVICE_${pathKey}`;
42
+ const strategyName = `${pathKey}-local`;
43
+ const LocalStrategy = (0, nestauth_local_strategy_1.createLocalStrategy)(strategyName, userServiceToken);
44
+ const LocalGuard = (0, nestauth_local_guard_1.createLocalGuard)(strategyName);
45
+ console.log("controllerPath", controllerPath);
46
+ console.log("pathKey", pathKey);
47
+ console.log("userServiceToken", userServiceToken);
48
+ console.log("nestAuthServiceToken", nestAuthServiceToken);
49
+ console.log("------------------------------------------");
50
+ const controller = (0, nestauth_controller_1.createDynamicController)(controllerPath, nestAuthServiceToken, LocalGuard);
47
51
  return {
48
52
  module: NestAuthModule_1,
49
53
  imports: [
@@ -61,37 +65,30 @@ let NestAuthModule = NestAuthModule_1 = class NestAuthModule {
61
65
  ],
62
66
  providers: [
63
67
  {
64
- provide: AUTH_SERVICE_TOKEN,
65
- useClass: nestauth_service_1.NestAuthService,
66
- },
67
- {
68
- provide: USER_SERVICE_TOKEN,
68
+ provide: userServiceToken,
69
69
  useExisting: options.UserService,
70
70
  },
71
71
  {
72
- provide: "UserService",
73
- useFactory: (userService) => userService,
74
- inject: [USER_SERVICE_TOKEN],
75
- },
76
- {
77
- provide: "JWT_SECRET",
78
- useValue: options.jwtSecret,
79
- },
80
- {
81
- provide: "JWT_EXPIRES_IN",
82
- useValue: options.jwtExpiresIn,
83
- },
84
- {
85
- provide: "JWT_REFRESH_TOKEN_EXPIRES_IN",
86
- useValue: options.jwtRefreshTokenExpiresIn,
72
+ provide: nestAuthServiceToken,
73
+ useFactory: (jwtService, userService, jwtExpiresIn, jwtRefreshTokenExpiresIn) => new nestauth_service_1.NestAuthService(jwtService, userService, jwtExpiresIn, jwtRefreshTokenExpiresIn),
74
+ inject: [
75
+ jwt_1.JwtService,
76
+ userServiceToken,
77
+ "JWT_EXPIRES_IN",
78
+ "JWT_REFRESH_TOKEN_EXPIRES_IN",
79
+ ],
87
80
  },
88
81
  nestauth_jwt_strategy_1.NestAuthJwtStrategy,
89
- nestauth_local_strategy_1.NestAuthLocalStrategy,
90
82
  nestauth_google_strategy_1.NestAuthGoogleStrategy,
91
83
  nestauth_facebook_strategy_1.NestAuthFacebookStrategy,
84
+ JwtSecretProvider,
85
+ JwtExpiresInProvider,
86
+ JwtRefreshTokenExpiresInProvider,
87
+ LocalStrategy,
88
+ LocalGuard,
92
89
  ],
93
- exports: [AUTH_SERVICE_TOKEN, "UserService"],
94
- controllers: [DynamicNestAuthController],
90
+ exports: [nestAuthServiceToken],
91
+ controllers: [controller],
95
92
  };
96
93
  }
97
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"nestauth.module.js","sourceRoot":"","sources":["../src/nestauth.module.ts"],"names":[],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AC,OAAO,CAAC,EAAE,CAAC,CAAC;KACtD,CAAC;GACW,cAAc,CA6G1B"}
@@ -3,7 +3,7 @@ import { JwtService } from "@nestjs/jwt";
3
3
  import { StringValue } from "ms";
4
4
  export declare class NestAuthService {
5
5
  private jwtService;
6
- private readonly userService;
6
+ readonly userService: NestAuthInterface;
7
7
  private readonly jwtExpiresIn;
8
8
  private readonly jwtRefreshTokenExpiresIn;
9
9
  constructor(jwtService: JwtService, userService: NestAuthInterface, jwtExpiresIn?: StringValue | number, jwtRefreshTokenExpiresIn?: StringValue | number);
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
+ var _a, _b;
14
15
  Object.defineProperty(exports, "__esModule", { value: true });
15
16
  exports.NestAuthService = void 0;
16
17
  const common_1 = require("@nestjs/common");
@@ -65,7 +66,6 @@ let NestAuthService = class NestAuthService {
65
66
  exports.NestAuthService = NestAuthService;
66
67
  exports.NestAuthService = NestAuthService = __decorate([
67
68
  (0, common_1.Injectable)(),
68
- __param(1, (0, common_1.Inject)("UserService")),
69
69
  __param(2, (0, common_1.Inject)("JWT_EXPIRES_IN")),
70
70
  __param(3, (0, common_1.Inject)("JWT_REFRESH_TOKEN_EXPIRES_IN")),
71
71
  __metadata("design:paramtypes", [jwt_1.JwtService, Object, Object, Object])
@@ -1 +1 @@
1
- {"version":3,"file":"nestauth.service.js","sourceRoot":"","sources":["../src/nestauth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2E;AAO3E,qCAAyC;AAIlC,IAAM,eAAe,GAArB,MAAM,eAAe;IACxB,YACY,UAAsB,EACU,WAA8B,EAErD,eAAqC,KAAK,EAE1C,2BAAiD,IAAI;QAL9D,eAAU,GAAV,UAAU,CAAY;QACU,gBAAW,GAAX,WAAW,CAAmB;QAErD,iBAAY,GAAZ,YAAY,CAA8B;Q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