@vynelix/nestjs-multi-auth 0.3.2 → 1.0.0
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/CHANGELOG.md +10 -0
- package/README.md +309 -18
- package/dist/auth/auth.controller.d.ts +3 -2
- package/dist/auth/auth.controller.js +32 -5
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.module.js +116 -68
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/auth.service.d.ts +52 -25
- package/dist/auth/auth.service.js +238 -327
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/core/auth-mapper.d.ts +1 -1
- package/dist/auth/core/database-otp.provider.d.ts +12 -0
- package/dist/auth/core/database-otp.provider.js +122 -0
- package/dist/auth/core/database-otp.provider.js.map +1 -0
- package/dist/auth/dto/requests/magic-link.dto.d.ts +1 -0
- package/dist/auth/dto/requests/magic-link.dto.js +6 -0
- package/dist/auth/dto/requests/magic-link.dto.js.map +1 -1
- package/dist/auth/dto/requests/mfa.dto.d.ts +5 -1
- package/dist/auth/dto/requests/mfa.dto.js +29 -8
- package/dist/auth/dto/requests/mfa.dto.js.map +1 -1
- package/dist/auth/enums/identifier-type.enum.d.ts +11 -0
- package/dist/auth/enums/identifier-type.enum.js +17 -0
- package/dist/auth/enums/identifier-type.enum.js.map +1 -0
- package/dist/auth/enums/mfa-type.enum.d.ts +5 -0
- package/dist/auth/enums/mfa-type.enum.js +10 -0
- package/dist/auth/enums/mfa-type.enum.js.map +1 -0
- package/dist/auth/enums/otp-purpose.enum.d.ts +8 -0
- package/dist/auth/enums/otp-purpose.enum.js +13 -0
- package/dist/auth/enums/otp-purpose.enum.js.map +1 -0
- package/dist/auth/enums/session-event.enum.d.ts +7 -0
- package/dist/auth/enums/session-event.enum.js +12 -0
- package/dist/auth/enums/session-event.enum.js.map +1 -0
- package/dist/auth/interfaces/auth-module-options.interface.d.ts +36 -1
- package/dist/auth/interfaces/auth-notification-provider.interface.d.ts +7 -1
- package/dist/auth/interfaces/auth-otp-provider.interface.d.ts +60 -0
- package/dist/auth/interfaces/auth-otp-provider.interface.js +7 -0
- package/dist/auth/interfaces/auth-otp-provider.interface.js.map +1 -0
- package/dist/auth/interfaces/models.interface.d.ts +91 -0
- package/dist/auth/interfaces/models.interface.js +3 -0
- package/dist/auth/interfaces/models.interface.js.map +1 -0
- package/dist/auth/interfaces/oauth-strategy.interface.d.ts +2 -2
- package/dist/auth/interfaces/repositories.interface.d.ts +70 -0
- package/dist/auth/interfaces/repositories.interface.js +3 -0
- package/dist/auth/interfaces/repositories.interface.js.map +1 -0
- package/dist/auth/interfaces/repository-tokens.d.ts +7 -0
- package/dist/auth/interfaces/repository-tokens.js +11 -0
- package/dist/auth/interfaces/repository-tokens.js.map +1 -0
- package/dist/auth/interfaces/signup-event-body.interface.d.ts +1 -1
- package/dist/auth/strategies/local-auth.strategy.d.ts +3 -5
- package/dist/auth/strategies/local-auth.strategy.js +64 -99
- package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/apple.strategy.d.ts +4 -6
- package/dist/auth/strategies/oauth/apple.strategy.js +57 -70
- package/dist/auth/strategies/oauth/apple.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/facebook.strategy.d.ts +4 -6
- package/dist/auth/strategies/oauth/facebook.strategy.js +58 -71
- package/dist/auth/strategies/oauth/facebook.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/google.strategy.d.ts +4 -6
- package/dist/auth/strategies/oauth/google.strategy.js +84 -155
- package/dist/auth/strategies/oauth/google.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/oauth.strategy.d.ts +2 -2
- package/dist/database/prisma/prisma-auth.adapter.d.ts +11 -0
- package/dist/database/prisma/prisma-auth.adapter.js +64 -0
- package/dist/database/prisma/prisma-auth.adapter.js.map +1 -0
- package/dist/database/prisma/repositories/auth-identifier.repository.d.ts +16 -0
- package/dist/database/prisma/repositories/auth-identifier.repository.js +41 -0
- package/dist/database/prisma/repositories/auth-identifier.repository.js.map +1 -0
- package/dist/database/prisma/repositories/auth.repository.d.ts +19 -0
- package/dist/database/prisma/repositories/auth.repository.js +49 -0
- package/dist/database/prisma/repositories/auth.repository.js.map +1 -0
- package/dist/database/prisma/repositories/index.d.ts +7 -0
- package/dist/database/prisma/repositories/index.js +24 -0
- package/dist/database/prisma/repositories/index.js.map +1 -0
- package/dist/database/prisma/repositories/mfa-method.repository.d.ts +11 -0
- package/dist/database/prisma/repositories/mfa-method.repository.js +33 -0
- package/dist/database/prisma/repositories/mfa-method.repository.js.map +1 -0
- package/dist/database/prisma/repositories/oauth-provider.repository.d.ts +14 -0
- package/dist/database/prisma/repositories/oauth-provider.repository.js +39 -0
- package/dist/database/prisma/repositories/oauth-provider.repository.js.map +1 -0
- package/dist/database/prisma/repositories/otp-token.repository.d.ts +13 -0
- package/dist/database/prisma/repositories/otp-token.repository.js +52 -0
- package/dist/database/prisma/repositories/otp-token.repository.js.map +1 -0
- package/dist/database/prisma/repositories/session-log.repository.d.ts +12 -0
- package/dist/database/prisma/repositories/session-log.repository.js +42 -0
- package/dist/database/prisma/repositories/session-log.repository.js.map +1 -0
- package/dist/database/prisma/repositories/session.repository.d.ts +16 -0
- package/dist/database/prisma/repositories/session.repository.js +41 -0
- package/dist/database/prisma/repositories/session.repository.js.map +1 -0
- package/dist/database/typeorm/entities/auth-identify.entity.d.ts +23 -0
- package/dist/database/typeorm/entities/auth-identify.entity.js +61 -0
- package/dist/database/typeorm/entities/auth-identify.entity.js.map +1 -0
- package/dist/database/typeorm/entities/auth.entity.d.ts +45 -0
- package/dist/database/typeorm/entities/auth.entity.js +129 -0
- package/dist/database/typeorm/entities/auth.entity.js.map +1 -0
- package/dist/database/typeorm/entities/base.entity.d.ts +7 -0
- package/dist/database/typeorm/entities/base.entity.js +44 -0
- package/dist/database/typeorm/entities/base.entity.js.map +1 -0
- package/dist/database/typeorm/entities/entities.d.ts +7 -0
- package/dist/database/typeorm/entities/entities.js +18 -0
- package/dist/database/typeorm/entities/entities.js.map +1 -0
- package/dist/database/typeorm/entities/mfa-method.entity.d.ts +10 -0
- package/dist/database/typeorm/entities/mfa-method.entity.js +47 -0
- package/dist/database/typeorm/entities/mfa-method.entity.js.map +1 -0
- package/dist/database/typeorm/entities/oauth-provider.entity.d.ts +38 -0
- package/dist/database/typeorm/entities/oauth-provider.entity.js +88 -0
- package/dist/database/typeorm/entities/oauth-provider.entity.js.map +1 -0
- package/dist/database/typeorm/entities/otp-token.entity.d.ts +15 -0
- package/dist/database/typeorm/entities/otp-token.entity.js +53 -0
- package/dist/database/typeorm/entities/otp-token.entity.js.map +1 -0
- package/dist/database/typeorm/entities/session.entity.d.ts +21 -0
- package/dist/database/typeorm/entities/session.entity.js +71 -0
- package/dist/database/typeorm/entities/session.entity.js.map +1 -0
- package/dist/database/typeorm/entities/session_log.entity.d.ts +25 -0
- package/dist/database/typeorm/entities/session_log.entity.js +78 -0
- package/dist/database/typeorm/entities/session_log.entity.js.map +1 -0
- package/dist/database/typeorm/migrations/auth-entities.d.ts +7 -0
- package/dist/database/typeorm/migrations/auth-entities.js +18 -0
- package/dist/database/typeorm/migrations/auth-entities.js.map +1 -0
- package/dist/database/typeorm/migrations/auth-schema.initializer.d.ts +9 -0
- package/dist/database/typeorm/migrations/auth-schema.initializer.js +36 -0
- package/dist/database/typeorm/migrations/auth-schema.initializer.js.map +1 -0
- package/dist/database/typeorm/migrations/auth.migration.v1.d.ts +12 -0
- package/dist/database/typeorm/migrations/auth.migration.v1.js +157 -0
- package/dist/database/typeorm/migrations/auth.migration.v1.js.map +1 -0
- package/dist/database/typeorm/migrations/auth.migration.v2.d.ts +8 -0
- package/dist/database/typeorm/migrations/auth.migration.v2.js +23 -0
- package/dist/database/typeorm/migrations/auth.migration.v2.js.map +1 -0
- package/dist/database/typeorm/migrations/auth.migrations.d.ts +2 -0
- package/dist/database/typeorm/migrations/auth.migrations.js +10 -0
- package/dist/database/typeorm/migrations/auth.migrations.js.map +1 -0
- package/dist/database/typeorm/migrations/migration.service.d.ts +9 -0
- package/dist/database/typeorm/migrations/migration.service.js +75 -0
- package/dist/database/typeorm/migrations/migration.service.js.map +1 -0
- package/dist/database/typeorm/repositories/auth-identifier.repository.d.ts +18 -0
- package/dist/database/typeorm/repositories/auth-identifier.repository.js +64 -0
- package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/auth.repository.d.ts +21 -0
- package/dist/database/typeorm/repositories/auth.repository.js +71 -0
- package/dist/database/typeorm/repositories/auth.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/index.d.ts +7 -0
- package/dist/database/typeorm/repositories/index.js +24 -0
- package/dist/database/typeorm/repositories/index.js.map +1 -0
- package/dist/database/typeorm/repositories/mfa-method.repository.d.ts +13 -0
- package/dist/database/typeorm/repositories/mfa-method.repository.js +46 -0
- package/dist/database/typeorm/repositories/mfa-method.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/oauth-provider.repository.d.ts +16 -0
- package/dist/database/typeorm/repositories/oauth-provider.repository.js +52 -0
- package/dist/database/typeorm/repositories/oauth-provider.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/otp-token.repository.d.ts +13 -0
- package/dist/database/typeorm/repositories/otp-token.repository.js +52 -0
- package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/session-log.repository.d.ts +12 -0
- package/dist/database/typeorm/repositories/session-log.repository.js +47 -0
- package/dist/database/typeorm/repositories/session-log.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/session.repository.d.ts +18 -0
- package/dist/database/typeorm/repositories/session.repository.js +84 -0
- package/dist/database/typeorm/repositories/session.repository.js.map +1 -0
- package/dist/database/typeorm/typeorm-auth.adapter.d.ts +2 -0
- package/dist/database/typeorm/typeorm-auth.adapter.js +50 -0
- package/dist/database/typeorm/typeorm-auth.adapter.js.map +1 -0
- package/dist/index.d.ts +11 -9
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/fix-imports.js +46 -0
- package/fix-syntax.js +66 -0
- package/package.json +22 -20
- package/patch-local-specs.js +52 -0
- package/patch-oauth-specs.js +41 -0
- package/patch-specs.js +36 -0
- package/prompts/database_adapter.md +157 -0
- package/prompts/otp_provider.md +292 -0
- package/scratch/create-prisma-repos-final.js +139 -0
- package/scratch/create-prisma-repos.js +280 -0
- package/scratch/fix-events-spec.js +12 -0
- package/scratch/fix-imports.js +53 -0
- package/scratch/fix-prisma-interfaces.js +41 -0
- package/scratch/fix-prisma-interfaces2.js +36 -0
- package/scratch/fix-prisma-interfaces3.js +26 -0
- package/scratch/fix-prisma.js +28 -0
- package/scratch/fix-test-imports.js +51 -0
- package/scratch/fix-tests-advanced.js +68 -0
- package/scratch/fix-tests-advanced2.js +23 -0
- package/scratch/fix-tests-concrete.js +40 -0
- package/scratch/fix-tests-final.js +35 -0
- package/scratch/fix-tests-final2.js +28 -0
- package/scratch/fix-tests-final3.js +26 -0
- package/scratch/fix-tests-methods.js +40 -0
- package/scratch/fix-tests-proxy.js +67 -0
- package/scratch/fix-tests-types.js +24 -0
- package/scratch/rewrite-tests.js +110 -0
- package/tsc_errors.txt +60 -0
- package/tsc_errors2.txt +93 -0
- package/tmp-cv-test/package-lock.json +0 -250
- package/tmp-cv-test/package.json +0 -17
- package/tmp-cv-test/test.ts +0 -11
package/dist/auth/auth.module.js
CHANGED
|
@@ -11,35 +11,30 @@ exports.AUTH_MODULE_OPTIONS = exports.AuthModule = void 0;
|
|
|
11
11
|
// src/auth/auth.module.ts
|
|
12
12
|
const common_1 = require("@nestjs/common");
|
|
13
13
|
const core_1 = require("@nestjs/core");
|
|
14
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
15
|
-
const auth_entity_1 = require("./entities/auth.entity");
|
|
16
|
-
const oauth_provider_entity_1 = require("./entities/oauth-provider.entity");
|
|
17
|
-
const otp_token_entity_1 = require("./entities/otp-token.entity");
|
|
18
|
-
const mfa_method_entity_1 = require("./entities/mfa-method.entity");
|
|
19
14
|
const auth_service_1 = require("./auth.service");
|
|
20
15
|
const auth_controller_1 = require("./auth.controller");
|
|
21
16
|
const jwt_1 = require("@nestjs/jwt");
|
|
22
17
|
const jwt_strategy_1 = require("./core/jwt.strategy");
|
|
23
18
|
const passport_1 = require("@nestjs/passport");
|
|
24
|
-
const auth_identify_entity_1 = require("./entities/auth-identify.entity");
|
|
25
|
-
const session_entity_1 = require("./entities/session.entity");
|
|
26
19
|
const auth_module_options_interface_1 = require("./interfaces/auth-module-options.interface");
|
|
27
20
|
Object.defineProperty(exports, "AUTH_MODULE_OPTIONS", { enumerable: true, get: function () { return auth_module_options_interface_1.AUTH_MODULE_OPTIONS; } });
|
|
28
21
|
const auth_notification_provider_interface_1 = require("./interfaces/auth-notification-provider.interface");
|
|
22
|
+
const auth_otp_provider_interface_1 = require("./interfaces/auth-otp-provider.interface");
|
|
29
23
|
const core_2 = require("@nestjs/core");
|
|
30
24
|
const jwt_auth_guard_1 = require("./guards/jwt-auth.guard");
|
|
31
25
|
const optional_auth_guard_1 = require("./guards/optional-auth.guard");
|
|
32
26
|
const throttler_1 = require("@nestjs/throttler");
|
|
33
27
|
const registration_1 = require("./core/registration");
|
|
34
|
-
const auth_schema_initializer_1 = require("../migrations/auth-schema.initializer");
|
|
35
|
-
const migration_service_1 = require("../migrations/migration.service");
|
|
28
|
+
const auth_schema_initializer_1 = require("../database/typeorm/migrations/auth-schema.initializer");
|
|
29
|
+
const migration_service_1 = require("../database/typeorm/migrations/migration.service");
|
|
36
30
|
const local_auth_strategy_1 = require("./strategies/local-auth.strategy");
|
|
37
31
|
const google_strategy_1 = require("./strategies/oauth/google.strategy");
|
|
38
32
|
const facebook_strategy_1 = require("./strategies/oauth/facebook.strategy");
|
|
39
33
|
const apple_strategy_1 = require("./strategies/oauth/apple.strategy");
|
|
40
34
|
const oauth_strategy_1 = require("./strategies/oauth/oauth.strategy");
|
|
41
35
|
const auth_context_resolver_1 = require("./core/auth-context.resolver");
|
|
42
|
-
const
|
|
36
|
+
const typeorm_auth_adapter_1 = require("../database/typeorm/typeorm-auth.adapter");
|
|
37
|
+
const database_otp_provider_1 = require("./core/database-otp.provider");
|
|
43
38
|
let AuthModule = AuthModule_1 = class AuthModule {
|
|
44
39
|
static register(options) {
|
|
45
40
|
const optionsProvider = {
|
|
@@ -64,33 +59,33 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
64
59
|
useClass: jwt_auth_guard_1.JwtAuthGuard,
|
|
65
60
|
});
|
|
66
61
|
}
|
|
62
|
+
const imports = [
|
|
63
|
+
passport_1.PassportModule,
|
|
64
|
+
jwt_1.JwtModule.register({
|
|
65
|
+
secret: options.jwtSecret || process.env.JWT_SECRET || 'changeme',
|
|
66
|
+
signOptions: { expiresIn: (options.accessTokenExpiresIn || '15m') },
|
|
67
|
+
}),
|
|
68
|
+
throttler_1.ThrottlerModule.forRoot({
|
|
69
|
+
throttlers: [
|
|
70
|
+
{
|
|
71
|
+
ttl: (options.throttlerTtl || 60) * 1000,
|
|
72
|
+
limit: options.throttlerLimit || 10,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
...(options.imports || []),
|
|
77
|
+
];
|
|
78
|
+
if (!options.adapter) {
|
|
79
|
+
imports.push(typeorm_auth_adapter_1.TypeOrmAuthAdapter);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
imports.push(options.adapter);
|
|
83
|
+
}
|
|
84
|
+
const defaultOtpClass = options.otpProvider || database_otp_provider_1.DatabaseOtpProvider;
|
|
85
|
+
providers.push({ provide: auth_otp_provider_interface_1.AUTH_OTP_PROVIDER, useClass: defaultOtpClass }, { provide: auth_otp_provider_interface_1.AUTH_OTP_PROVIDER_EMAIL, useClass: options.otpProviders?.email || defaultOtpClass }, { provide: auth_otp_provider_interface_1.AUTH_OTP_PROVIDER_PHONE, useClass: options.otpProviders?.phone || defaultOtpClass });
|
|
67
86
|
return {
|
|
68
87
|
module: AuthModule_1,
|
|
69
|
-
imports
|
|
70
|
-
typeorm_1.TypeOrmModule.forFeature([
|
|
71
|
-
auth_entity_1.Auth,
|
|
72
|
-
oauth_provider_entity_1.OAuthProvider,
|
|
73
|
-
auth_identify_entity_1.AuthIdentifier,
|
|
74
|
-
otp_token_entity_1.OtpToken,
|
|
75
|
-
mfa_method_entity_1.MfaMethod,
|
|
76
|
-
session_entity_1.Session,
|
|
77
|
-
session_log_entity_1.SessionLog,
|
|
78
|
-
]),
|
|
79
|
-
passport_1.PassportModule,
|
|
80
|
-
jwt_1.JwtModule.register({
|
|
81
|
-
secret: options.jwtSecret || process.env.JWT_SECRET || 'changeme',
|
|
82
|
-
signOptions: { expiresIn: (options.accessTokenExpiresIn || '15m') },
|
|
83
|
-
}),
|
|
84
|
-
throttler_1.ThrottlerModule.forRoot({
|
|
85
|
-
throttlers: [
|
|
86
|
-
{
|
|
87
|
-
ttl: (options.throttlerTtl || 60) * 1000,
|
|
88
|
-
limit: options.throttlerLimit || 10,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
}),
|
|
92
|
-
...(options.imports || []),
|
|
93
|
-
],
|
|
88
|
+
imports,
|
|
94
89
|
providers,
|
|
95
90
|
controllers: options.disableController ? [] : [auth_controller_1.AuthController],
|
|
96
91
|
exports: [auth_service_1.AuthService, jwt_auth_guard_1.JwtAuthGuard, optional_auth_guard_1.OptionalAuthGuard, throttler_1.ThrottlerModule, jwt_1.JwtModule, passport_1.PassportModule, auth_module_options_interface_1.AUTH_MODULE_OPTIONS],
|
|
@@ -114,42 +109,34 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
114
109
|
useFactory: options.useFactory,
|
|
115
110
|
inject: options.inject || [],
|
|
116
111
|
};
|
|
112
|
+
const imports = [
|
|
113
|
+
passport_1.PassportModule,
|
|
114
|
+
jwt_1.JwtModule.registerAsync({
|
|
115
|
+
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS],
|
|
116
|
+
useFactory: async (opts) => ({
|
|
117
|
+
secret: opts.jwtSecret || process.env.JWT_SECRET || 'changeme',
|
|
118
|
+
signOptions: {
|
|
119
|
+
expiresIn: (opts.accessTokenExpiresIn || '15m'),
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
}),
|
|
123
|
+
throttler_1.ThrottlerModule.forRootAsync({
|
|
124
|
+
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS],
|
|
125
|
+
useFactory: async (opts) => ({
|
|
126
|
+
throttlers: [
|
|
127
|
+
{
|
|
128
|
+
ttl: (opts.throttlerTtl || 60) * 1000,
|
|
129
|
+
limit: opts.throttlerLimit || 10,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
}),
|
|
133
|
+
}),
|
|
134
|
+
...(options.imports || []),
|
|
135
|
+
];
|
|
117
136
|
return {
|
|
118
137
|
module: AuthModule_1,
|
|
119
138
|
global: true,
|
|
120
|
-
imports
|
|
121
|
-
typeorm_1.TypeOrmModule.forFeature([
|
|
122
|
-
auth_entity_1.Auth,
|
|
123
|
-
oauth_provider_entity_1.OAuthProvider,
|
|
124
|
-
auth_identify_entity_1.AuthIdentifier,
|
|
125
|
-
otp_token_entity_1.OtpToken,
|
|
126
|
-
mfa_method_entity_1.MfaMethod,
|
|
127
|
-
session_entity_1.Session,
|
|
128
|
-
session_log_entity_1.SessionLog,
|
|
129
|
-
]),
|
|
130
|
-
passport_1.PassportModule,
|
|
131
|
-
jwt_1.JwtModule.registerAsync({
|
|
132
|
-
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS],
|
|
133
|
-
useFactory: async (opts) => ({
|
|
134
|
-
secret: opts.jwtSecret || process.env.JWT_SECRET || 'changeme',
|
|
135
|
-
signOptions: {
|
|
136
|
-
expiresIn: (opts.accessTokenExpiresIn || '15m'),
|
|
137
|
-
},
|
|
138
|
-
}),
|
|
139
|
-
}),
|
|
140
|
-
throttler_1.ThrottlerModule.forRootAsync({
|
|
141
|
-
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS],
|
|
142
|
-
useFactory: async (opts) => ({
|
|
143
|
-
throttlers: [
|
|
144
|
-
{
|
|
145
|
-
ttl: (opts.throttlerTtl || 60) * 1000,
|
|
146
|
-
limit: opts.throttlerLimit || 10,
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
}),
|
|
150
|
-
}),
|
|
151
|
-
...(options.imports || []),
|
|
152
|
-
],
|
|
139
|
+
imports,
|
|
153
140
|
providers: [
|
|
154
141
|
asyncOptionsProvider,
|
|
155
142
|
...this.createProviders(),
|
|
@@ -158,6 +145,67 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
158
145
|
facebook_strategy_1.FacebookAuthStrategy,
|
|
159
146
|
apple_strategy_1.AppleAuthStrategy,
|
|
160
147
|
oauth_strategy_1.OAuthAuthStrategy,
|
|
148
|
+
{
|
|
149
|
+
provide: auth_otp_provider_interface_1.AUTH_OTP_PROVIDER,
|
|
150
|
+
useFactory: (opts, moduleRef) => {
|
|
151
|
+
const provider = opts.otpProvider || database_otp_provider_1.DatabaseOtpProvider;
|
|
152
|
+
if (typeof provider === 'function' && provider.prototype) {
|
|
153
|
+
try {
|
|
154
|
+
return moduleRef.get(provider, { strict: false });
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
return new provider(moduleRef);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return provider;
|
|
161
|
+
},
|
|
162
|
+
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS, core_1.ModuleRef],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
provide: auth_otp_provider_interface_1.AUTH_OTP_PROVIDER_EMAIL,
|
|
166
|
+
useFactory: (opts, moduleRef) => {
|
|
167
|
+
const provider = opts.otpProviders?.email || opts.otpProvider || database_otp_provider_1.DatabaseOtpProvider;
|
|
168
|
+
if (typeof provider === 'function' && provider.prototype) {
|
|
169
|
+
try {
|
|
170
|
+
return moduleRef.get(provider, { strict: false });
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
return new provider(moduleRef);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return provider;
|
|
177
|
+
},
|
|
178
|
+
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS, core_1.ModuleRef],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
provide: auth_otp_provider_interface_1.AUTH_OTP_PROVIDER_PHONE,
|
|
182
|
+
useFactory: (opts, moduleRef) => {
|
|
183
|
+
const provider = opts.otpProviders?.phone || opts.otpProvider || database_otp_provider_1.DatabaseOtpProvider;
|
|
184
|
+
if (typeof provider === 'function' && provider.prototype) {
|
|
185
|
+
try {
|
|
186
|
+
return moduleRef.get(provider, { strict: false });
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
return new provider(moduleRef);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return provider;
|
|
193
|
+
},
|
|
194
|
+
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS, core_1.ModuleRef],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
provide: 'DYNAMIC_ADAPTER_REGISTRAR',
|
|
198
|
+
useFactory: (opts, moduleRef) => {
|
|
199
|
+
if (!opts.adapter) {
|
|
200
|
+
// Wait, TypeOrmAuthAdapter is a dynamic module, it should be in imports, not providers.
|
|
201
|
+
// So we should do this in imports, but options in async is not available at import time!
|
|
202
|
+
// For async module, imports MUST be defined statically or returned in DynamicModule.
|
|
203
|
+
// This is a common issue with NestJS async modules. We'll handle this in a specific way.
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
},
|
|
207
|
+
inject: [auth_module_options_interface_1.AUTH_MODULE_OPTIONS, core_1.ModuleRef],
|
|
208
|
+
},
|
|
161
209
|
{
|
|
162
210
|
provide: auth_notification_provider_interface_1.AUTH_NOTIFICATION_PROVIDER,
|
|
163
211
|
useFactory: (opts, moduleRef) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,0BAA0B;AAC1B,2CAAyE;AACzE,uCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,0BAA0B;AAC1B,2CAAyE;AACzE,uCAAyC;AACzC,iDAA6C;AAC7C,uDAAmD;AACnD,qCAAwC;AACxC,sDAAkD;AAClD,+CAAkD;AAClD,8FAAoG;AAiO3F,oGAjOA,mDAAmB,OAiOA;AAhO5B,4GAA+F;AAC/F,0FAA+H;AAC/H,uCAAyC;AACzC,4DAAuD;AACvD,sEAAiE;AACjE,iDAAoE;AACpE,sDAA8D;AAE9D,oGAA+F;AAC/F,wFAAwF;AACxF,0EAAqE;AACrE,wEAAwE;AACxE,4EAA4E;AAC5E,sEAAsE;AACtE,sEAAsE;AACtE,wEAAkE;AAClE,mFAA8E;AAC9E,wEAAmE;AAM5D,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,OAA0B;QACxC,MAAM,eAAe,GAAa;YAChC,OAAO,EAAE,mDAAmB;YAC5B,QAAQ,EAAE,OAAO;SAClB,CAAC;QAEF,MAAM,iBAAiB,GAAG,IAAA,sCAAuB,EAAC,OAAO,CAAC,CAAC;QAE3D,MAAM,SAAS,GAAe;YAC5B,eAAe;YACf,GAAG,IAAI,CAAC,eAAe,EAAE;YACzB,GAAG,iBAAiB;SACrB,CAAC;QAEF,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;YACjC,SAAS,CAAC,IAAI,CAAC;gBACb,OAAO,EAAE,iEAA0B;gBACnC,QAAQ,EAAE,OAAO,CAAC,oBAAoB;aACvC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,OAAO,C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AAC;GACE,UAAU,CAwMtB"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
2
2
|
import { JwtService } from '@nestjs/jwt';
|
|
3
|
-
import {
|
|
3
|
+
import { AuthRepository, SessionRepository, SessionLogRepository, MfaMethodRepository, AuthIdentifierRepository } from './interfaces/repositories.interface';
|
|
4
|
+
import { AuthOtpProvider } from './interfaces/auth-otp-provider.interface';
|
|
4
5
|
import { SignupDto } from './dto/requests/signup.dto';
|
|
5
6
|
import { LoginDto } from './dto/requests/login.dto';
|
|
6
7
|
import { LocalAuthStrategy } from './strategies/local-auth.strategy';
|
|
7
8
|
import { OAuthAuthStrategy } from './strategies/oauth/oauth.strategy';
|
|
8
9
|
import { AuthStrategy } from './enums/auth-type.enum';
|
|
9
|
-
import { Auth } from './
|
|
10
|
-
import {
|
|
11
|
-
import { OtpToken } from './entities/otp-token.entity';
|
|
12
|
-
import { MfaMethod, MfaType } from './entities/mfa-method.entity';
|
|
10
|
+
import { Auth, Session } from './interfaces/models.interface';
|
|
11
|
+
import { MfaType } from './enums/mfa-type.enum';
|
|
13
12
|
import { AuthModuleOptions } from './interfaces/auth-module-options.interface';
|
|
14
13
|
import { AuthNotificationProvider } from './interfaces/auth-notification-provider.interface';
|
|
15
14
|
import { ForgotPasswordDto } from './dto/requests/forgot-password.dto';
|
|
@@ -17,8 +16,8 @@ import { ResetPasswordDto } from './dto/requests/reset-password.dto';
|
|
|
17
16
|
import { UpdatePasswordDto } from './dto/requests/update-password.dto';
|
|
18
17
|
import { MagicLinkRequestDto, MagicLinkVerifyDto } from './dto/requests/magic-link.dto';
|
|
19
18
|
import { SecureAccountDto } from './dto/requests/secure-account.dto';
|
|
20
|
-
import { AuthIdentifier } from './
|
|
21
|
-
import { SessionLog } from './
|
|
19
|
+
import { AuthIdentifier } from './interfaces/models.interface';
|
|
20
|
+
import { SessionLog } from './interfaces/models.interface';
|
|
22
21
|
export declare class AuthService {
|
|
23
22
|
private jwtService;
|
|
24
23
|
private passwordStrategy;
|
|
@@ -26,14 +25,19 @@ export declare class AuthService {
|
|
|
26
25
|
private sessionRepository;
|
|
27
26
|
private sessionLogRepo;
|
|
28
27
|
private authRepo;
|
|
29
|
-
private
|
|
28
|
+
private authIdentifierRepo;
|
|
29
|
+
private otpProvider;
|
|
30
|
+
private otpProviderEmail;
|
|
31
|
+
private otpProviderPhone;
|
|
30
32
|
private mfaRepo;
|
|
31
33
|
private options;
|
|
32
34
|
private notificationProvider?;
|
|
33
35
|
private readonly eventEmitter?;
|
|
34
36
|
private readonly logger;
|
|
35
37
|
private readonly createSessionLog;
|
|
36
|
-
constructor(jwtService: JwtService, passwordStrategy: LocalAuthStrategy, oauthStrategy: OAuthAuthStrategy, sessionRepository:
|
|
38
|
+
constructor(jwtService: JwtService, passwordStrategy: LocalAuthStrategy, oauthStrategy: OAuthAuthStrategy, sessionRepository: SessionRepository, sessionLogRepo: SessionLogRepository, authRepo: AuthRepository, authIdentifierRepo: AuthIdentifierRepository, otpProvider: AuthOtpProvider, otpProviderEmail: AuthOtpProvider, otpProviderPhone: AuthOtpProvider, mfaRepo: MfaMethodRepository, options: AuthModuleOptions, notificationProvider?: AuthNotificationProvider, eventEmitter?: EventEmitter2);
|
|
39
|
+
/** Returns the correct OTP provider for the given identifier type. */
|
|
40
|
+
private resolveOtpProvider;
|
|
37
41
|
private generateTokens;
|
|
38
42
|
private fingerprint;
|
|
39
43
|
private createSession;
|
|
@@ -51,34 +55,36 @@ export declare class AuthService {
|
|
|
51
55
|
auth: {
|
|
52
56
|
uid: string;
|
|
53
57
|
strategy: AuthStrategy;
|
|
54
|
-
identifiers: AuthIdentifier[];
|
|
55
58
|
isPrimary: boolean;
|
|
56
59
|
isVerified: boolean;
|
|
57
60
|
isActive: boolean;
|
|
58
61
|
meta?: Record<string, any>;
|
|
59
62
|
lastUsedAt?: Date;
|
|
60
|
-
|
|
63
|
+
identifiers?: AuthIdentifier[];
|
|
64
|
+
oauthProviders?: import("./interfaces/models.interface").OAuthProvider[];
|
|
65
|
+
toMap(): Record<string, any>;
|
|
61
66
|
id: string;
|
|
62
67
|
createdAt: Date;
|
|
63
68
|
updatedAt: Date;
|
|
64
|
-
deletedAt
|
|
69
|
+
deletedAt?: Date;
|
|
65
70
|
};
|
|
66
71
|
verificationRequired: boolean;
|
|
67
72
|
} | {
|
|
68
73
|
auth: {
|
|
69
74
|
uid: string;
|
|
70
75
|
strategy: AuthStrategy;
|
|
71
|
-
identifiers: AuthIdentifier[];
|
|
72
76
|
isPrimary: boolean;
|
|
73
77
|
isVerified: boolean;
|
|
74
78
|
isActive: boolean;
|
|
75
79
|
meta?: Record<string, any>;
|
|
76
80
|
lastUsedAt?: Date;
|
|
77
|
-
|
|
81
|
+
identifiers?: AuthIdentifier[];
|
|
82
|
+
oauthProviders?: import("./interfaces/models.interface").OAuthProvider[];
|
|
83
|
+
toMap(): Record<string, any>;
|
|
78
84
|
id: string;
|
|
79
85
|
createdAt: Date;
|
|
80
86
|
updatedAt: Date;
|
|
81
|
-
deletedAt
|
|
87
|
+
deletedAt?: Date;
|
|
82
88
|
};
|
|
83
89
|
accessToken: string;
|
|
84
90
|
refreshToken: string;
|
|
@@ -101,17 +107,18 @@ export declare class AuthService {
|
|
|
101
107
|
auth: {
|
|
102
108
|
uid: string;
|
|
103
109
|
strategy: AuthStrategy;
|
|
104
|
-
identifiers: AuthIdentifier[];
|
|
105
110
|
isPrimary: boolean;
|
|
106
111
|
isVerified: boolean;
|
|
107
112
|
isActive: boolean;
|
|
108
113
|
meta?: Record<string, any>;
|
|
109
114
|
lastUsedAt?: Date;
|
|
110
|
-
|
|
115
|
+
identifiers?: AuthIdentifier[];
|
|
116
|
+
oauthProviders?: import("./interfaces/models.interface").OAuthProvider[];
|
|
117
|
+
toMap(): Record<string, any>;
|
|
111
118
|
id: string;
|
|
112
119
|
createdAt: Date;
|
|
113
120
|
updatedAt: Date;
|
|
114
|
-
deletedAt
|
|
121
|
+
deletedAt?: Date;
|
|
115
122
|
};
|
|
116
123
|
mfaRequired: boolean;
|
|
117
124
|
tokens: any;
|
|
@@ -120,17 +127,18 @@ export declare class AuthService {
|
|
|
120
127
|
auth: {
|
|
121
128
|
uid: string;
|
|
122
129
|
strategy: AuthStrategy;
|
|
123
|
-
identifiers: AuthIdentifier[];
|
|
124
130
|
isPrimary: boolean;
|
|
125
131
|
isVerified: boolean;
|
|
126
132
|
isActive: boolean;
|
|
127
133
|
meta?: Record<string, any>;
|
|
128
134
|
lastUsedAt?: Date;
|
|
129
|
-
|
|
135
|
+
identifiers?: AuthIdentifier[];
|
|
136
|
+
oauthProviders?: import("./interfaces/models.interface").OAuthProvider[];
|
|
137
|
+
toMap(): Record<string, any>;
|
|
130
138
|
id: string;
|
|
131
139
|
createdAt: Date;
|
|
132
140
|
updatedAt: Date;
|
|
133
|
-
deletedAt
|
|
141
|
+
deletedAt?: Date;
|
|
134
142
|
};
|
|
135
143
|
accessToken: string;
|
|
136
144
|
refreshToken: string;
|
|
@@ -147,10 +155,6 @@ export declare class AuthService {
|
|
|
147
155
|
ip?: string;
|
|
148
156
|
namespace?: string;
|
|
149
157
|
}): Promise<{
|
|
150
|
-
message: string;
|
|
151
|
-
tokens?: undefined;
|
|
152
|
-
auth?: undefined;
|
|
153
|
-
} | {
|
|
154
158
|
message: string;
|
|
155
159
|
tokens: {
|
|
156
160
|
accessToken: string;
|
|
@@ -207,6 +211,29 @@ export declare class AuthService {
|
|
|
207
211
|
activateMfa(uid: string, type: MfaType, code: string): Promise<{
|
|
208
212
|
message: string;
|
|
209
213
|
}>;
|
|
214
|
+
mfaLogin(uid: string, code: string, userAgent?: string, ip?: string, namespace?: string): Promise<{
|
|
215
|
+
message: string;
|
|
216
|
+
tokens: {
|
|
217
|
+
accessToken: string;
|
|
218
|
+
refreshToken: string;
|
|
219
|
+
};
|
|
220
|
+
auth: {
|
|
221
|
+
uid: string;
|
|
222
|
+
strategy: AuthStrategy;
|
|
223
|
+
isPrimary: boolean;
|
|
224
|
+
isVerified: boolean;
|
|
225
|
+
isActive: boolean;
|
|
226
|
+
meta?: Record<string, any>;
|
|
227
|
+
lastUsedAt?: Date;
|
|
228
|
+
identifiers?: AuthIdentifier[];
|
|
229
|
+
oauthProviders?: import("./interfaces/models.interface").OAuthProvider[];
|
|
230
|
+
toMap(): Record<string, any>;
|
|
231
|
+
id: string;
|
|
232
|
+
createdAt: Date;
|
|
233
|
+
updatedAt: Date;
|
|
234
|
+
deletedAt?: Date;
|
|
235
|
+
};
|
|
236
|
+
}>;
|
|
210
237
|
viewAll(): Promise<import("./dto/responses/auth-response.dto").AuthResponseDto[]>;
|
|
211
238
|
me(uid: string): Promise<import("./dto/responses/auth-response.dto").AuthResponseDto>;
|
|
212
239
|
viewAllMyAuthMethods(uid: string): Promise<import("./dto/responses/auth-response.dto").AuthResponseDto[]>;
|