ecrs-auth-core 1.0.30 → 1.0.32
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 +14 -72
- package/package.json +1 -1
package/dist/auth.module.js
CHANGED
|
@@ -20,64 +20,6 @@ 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
|
-
// }
|
|
81
23
|
let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
82
24
|
static registerAsync(options) {
|
|
83
25
|
const authCoreOptionsProvider = {
|
|
@@ -85,20 +27,21 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
85
27
|
inject: options.inject,
|
|
86
28
|
useFactory: options.useFactory,
|
|
87
29
|
};
|
|
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
|
-
});
|
|
99
30
|
return {
|
|
100
31
|
module: AuthCoreModule_1,
|
|
101
|
-
imports: [
|
|
32
|
+
imports: [
|
|
33
|
+
jwt_1.JwtModule.registerAsync({
|
|
34
|
+
inject: [exports.AUTH_CORE_OPTIONS],
|
|
35
|
+
useFactory: async (options) => {
|
|
36
|
+
console.log('✅ JWT_SECRET:', options.jwtSecret);
|
|
37
|
+
console.log('✅ JWT_EXPIRES_IN:', options.jwtExpiresIn);
|
|
38
|
+
return {
|
|
39
|
+
secret: options.jwtSecret,
|
|
40
|
+
signOptions: { expiresIn: options.jwtExpiresIn },
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
102
45
|
providers: [
|
|
103
46
|
authCoreOptionsProvider,
|
|
104
47
|
{
|
|
@@ -117,10 +60,9 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
117
60
|
],
|
|
118
61
|
controllers: [auth_controller_1.AuthController],
|
|
119
62
|
exports: [
|
|
120
|
-
jwt_1.JwtModule,
|
|
121
63
|
auth_service_1.AuthService,
|
|
122
|
-
jwt_strategy_1.JwtStrategy,
|
|
123
64
|
jwt_guard_1.JwtAuthGuard,
|
|
65
|
+
jwt_strategy_1.JwtStrategy,
|
|
124
66
|
module_guard_1.ModuleGuard,
|
|
125
67
|
roles_guard_1.RolesGuard,
|
|
126
68
|
feature_guard_1.FeatureGuard,
|