ecrs-auth-core 1.0.27 → 1.0.29
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.
- package/dist/auth.module.js +73 -16
- package/dist/jwt/jwt.strategy.js +0 -1
- package/package.json +1 -1
package/dist/auth.module.js
CHANGED
|
@@ -20,31 +20,87 @@ const feature_guard_1 = require("./guards/feature.guard");
|
|
|
20
20
|
const route_guard_1 = require("./guards/route.guard");
|
|
21
21
|
const permission_guard_1 = require("./guards/permission.guard");
|
|
22
22
|
exports.AUTH_CORE_OPTIONS = 'AUTH_CORE_OPTIONS';
|
|
23
|
+
// @Global()
|
|
24
|
+
// @Module({})
|
|
25
|
+
// export class AuthCoreModule {
|
|
26
|
+
// static registerAsync(options: {
|
|
27
|
+
// inject: any[];
|
|
28
|
+
// useFactory: (...args: any[]) => Promise<AuthCoreOptions>;
|
|
29
|
+
// }): DynamicModule {
|
|
30
|
+
// const asyncProvider = {
|
|
31
|
+
// provide: AUTH_CORE_OPTIONS,
|
|
32
|
+
// inject: options.inject,
|
|
33
|
+
// useFactory: options.useFactory,
|
|
34
|
+
// };
|
|
35
|
+
// return {
|
|
36
|
+
// module: AuthCoreModule,
|
|
37
|
+
// imports: [JwtModule.register({})],
|
|
38
|
+
// providers: [
|
|
39
|
+
// asyncProvider,
|
|
40
|
+
// {
|
|
41
|
+
// provide: 'ASYNC_JWT_OPTIONS',
|
|
42
|
+
// useFactory: async (options: AuthCoreOptions) => ({
|
|
43
|
+
// secret: options.jwtSecret,
|
|
44
|
+
// signOptions: { expiresIn: options.jwtExpiresIn },
|
|
45
|
+
// }),
|
|
46
|
+
// inject: [AUTH_CORE_OPTIONS],
|
|
47
|
+
// },
|
|
48
|
+
// {
|
|
49
|
+
// provide: JwtModule,
|
|
50
|
+
// useFactory: async (jwtOptions: any) => JwtModule.register(jwtOptions),
|
|
51
|
+
// inject: ['ASYNC_JWT_OPTIONS'],
|
|
52
|
+
// },
|
|
53
|
+
// {
|
|
54
|
+
// provide: 'MODULE_CONFIG',
|
|
55
|
+
// useFactory: (options: AuthCoreOptions) => options.moduleConfig || {},
|
|
56
|
+
// inject: [AUTH_CORE_OPTIONS],
|
|
57
|
+
// },
|
|
58
|
+
// AuthService,
|
|
59
|
+
// JwtStrategy,
|
|
60
|
+
// JwtAuthGuard,
|
|
61
|
+
// ModuleGuard,
|
|
62
|
+
// RolesGuard,
|
|
63
|
+
// FeatureGuard,
|
|
64
|
+
// RouteGuard,
|
|
65
|
+
// PermissionGuard,
|
|
66
|
+
// ],
|
|
67
|
+
// controllers: [AuthController],
|
|
68
|
+
// exports: [
|
|
69
|
+
// AuthService,
|
|
70
|
+
// JwtStrategy,
|
|
71
|
+
// JwtAuthGuard,
|
|
72
|
+
// ModuleGuard,
|
|
73
|
+
// RolesGuard,
|
|
74
|
+
// FeatureGuard,
|
|
75
|
+
// RouteGuard,
|
|
76
|
+
// PermissionGuard,
|
|
77
|
+
// ],
|
|
78
|
+
// };
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
23
81
|
let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
24
82
|
static registerAsync(options) {
|
|
25
|
-
const
|
|
83
|
+
const authCoreOptionsProvider = {
|
|
26
84
|
provide: exports.AUTH_CORE_OPTIONS,
|
|
27
85
|
inject: options.inject,
|
|
28
86
|
useFactory: options.useFactory,
|
|
29
87
|
};
|
|
88
|
+
const asyncJwtModule = jwt_1.JwtModule.registerAsync({
|
|
89
|
+
inject: [exports.AUTH_CORE_OPTIONS],
|
|
90
|
+
useFactory: async (options) => {
|
|
91
|
+
console.log('✅ JWT_SECRET:', options.jwtSecret);
|
|
92
|
+
console.log('✅ JWT_EXPIRES_IN:', options.jwtExpiresIn);
|
|
93
|
+
return {
|
|
94
|
+
secret: options.jwtSecret,
|
|
95
|
+
signOptions: { expiresIn: options.jwtExpiresIn },
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
});
|
|
30
99
|
return {
|
|
31
100
|
module: AuthCoreModule_1,
|
|
32
|
-
imports: [
|
|
101
|
+
imports: [asyncJwtModule],
|
|
33
102
|
providers: [
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
provide: 'ASYNC_JWT_OPTIONS',
|
|
37
|
-
useFactory: async (options) => ({
|
|
38
|
-
secret: options.jwtSecret,
|
|
39
|
-
signOptions: { expiresIn: options.jwtExpiresIn },
|
|
40
|
-
}),
|
|
41
|
-
inject: [exports.AUTH_CORE_OPTIONS],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
provide: jwt_1.JwtModule,
|
|
45
|
-
useFactory: async (jwtOptions) => jwt_1.JwtModule.register(jwtOptions),
|
|
46
|
-
inject: ['ASYNC_JWT_OPTIONS'],
|
|
47
|
-
},
|
|
103
|
+
authCoreOptionsProvider,
|
|
48
104
|
{
|
|
49
105
|
provide: 'MODULE_CONFIG',
|
|
50
106
|
useFactory: (options) => options.moduleConfig || {},
|
|
@@ -61,6 +117,7 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
61
117
|
],
|
|
62
118
|
controllers: [auth_controller_1.AuthController],
|
|
63
119
|
exports: [
|
|
120
|
+
jwt_1.JwtModule,
|
|
64
121
|
auth_service_1.AuthService,
|
|
65
122
|
jwt_strategy_1.JwtStrategy,
|
|
66
123
|
jwt_guard_1.JwtAuthGuard,
|
package/dist/jwt/jwt.strategy.js
CHANGED
|
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.JwtStrategy = void 0;
|
|
13
|
-
// src/jwt/jwt.strategy.ts
|
|
14
13
|
const common_1 = require("@nestjs/common");
|
|
15
14
|
const passport_1 = require("@nestjs/passport");
|
|
16
15
|
const passport_jwt_1 = require("passport-jwt");
|