@ackplus/nest-auth 0.1.45 → 0.1.47
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/README.md +102 -1
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +4 -1
- package/src/index.js.map +1 -1
- package/src/lib/auth/dto/requests/signup.request.dto.d.ts +1 -0
- package/src/lib/auth/dto/requests/signup.request.dto.js.map +1 -1
- package/src/lib/auth/guards/auth.guard.d.ts +1 -0
- package/src/lib/auth/guards/auth.guard.js +149 -57
- package/src/lib/auth/guards/auth.guard.js.map +1 -1
- package/src/lib/auth/services/auth.service.d.ts +3 -1
- package/src/lib/auth/services/auth.service.js +253 -187
- package/src/lib/auth/services/auth.service.js.map +1 -1
- package/src/lib/core/core.module.js +3 -0
- package/src/lib/core/core.module.js.map +1 -1
- package/src/lib/core/decorators/auth.decorator.d.ts +1 -0
- package/src/lib/core/decorators/auth.decorator.js +8 -0
- package/src/lib/core/decorators/auth.decorator.js.map +1 -0
- package/src/lib/core/index.d.ts +1 -0
- package/src/lib/core/index.js +1 -0
- package/src/lib/core/index.js.map +1 -1
- package/src/lib/core/interfaces/auth-module-options.interface.d.ts +2 -0
- package/src/lib/core/services/auth-config.service.js +7 -0
- package/src/lib/core/services/auth-config.service.js.map +1 -1
- package/src/lib/core/services/debug-logger.service.d.ts +38 -0
- package/src/lib/core/services/debug-logger.service.js +156 -0
- package/src/lib/core/services/debug-logger.service.js.map +1 -0
- package/src/lib/nest-auth.module.js +7 -0
- package/src/lib/nest-auth.module.js.map +1 -1
- package/src/lib/tenant/services/tenant.service.d.ts +3 -1
- package/src/lib/tenant/services/tenant.service.js +13 -3
- package/src/lib/tenant/services/tenant.service.js.map +1 -1
- package/src/lib/user/services/user.service.d.ts +3 -1
- package/src/lib/user/services/user.service.js +157 -86
- package/src/lib/user/services/user.service.js.map +1 -1
package/README.md
CHANGED
|
@@ -410,7 +410,108 @@ NestAuthModule.forRoot({
|
|
|
410
410
|
- **Automatic tenant resolution**: No need to specify tenant ID in auth operations
|
|
411
411
|
- **Backward compatibility**: Existing apps can add this without breaking changes
|
|
412
412
|
|
|
413
|
-
For detailed examples and configuration options, see
|
|
413
|
+
For detailed examples and configuration options, see the Default Tenant Configuration section above.
|
|
414
|
+
|
|
415
|
+
## Debug Logging
|
|
416
|
+
|
|
417
|
+
The nest-auth package includes comprehensive debug logging to help you troubleshoot issues during development. Debug logging is configurable and can provide detailed insights into authentication flows, user operations, and more.
|
|
418
|
+
|
|
419
|
+
### Enable Debug Logging
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
NestAuthModule.forRoot({
|
|
423
|
+
jwt: { secret: 'your-secret' },
|
|
424
|
+
debug: {
|
|
425
|
+
enabled: true,
|
|
426
|
+
level: 'debug', // 'error' | 'warn' | 'info' | 'debug' | 'verbose'
|
|
427
|
+
prefix: '[NestAuth]',
|
|
428
|
+
includeTimestamp: true,
|
|
429
|
+
includeContext: true
|
|
430
|
+
},
|
|
431
|
+
// ... other options
|
|
432
|
+
})
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Debug Configuration Options
|
|
436
|
+
|
|
437
|
+
- **`enabled`** (default: `false`): Enable/disable debug logging
|
|
438
|
+
- **`level`** (default: `'info'`): Log level - controls which messages are shown
|
|
439
|
+
- **`prefix`** (default: `'[NestAuth]'`): Prefix for all log messages
|
|
440
|
+
- **`includeTimestamp`** (default: `true`): Include timestamp in log messages
|
|
441
|
+
- **`includeContext`** (default: `true`): Include context (service name) in log messages
|
|
442
|
+
|
|
443
|
+
### Log Levels
|
|
444
|
+
|
|
445
|
+
- **`error`**: Only error messages
|
|
446
|
+
- **`warn`**: Errors and warnings
|
|
447
|
+
- **`info`**: Errors, warnings, and info messages
|
|
448
|
+
- **`debug`**: All above plus debug messages
|
|
449
|
+
- **`verbose`**: All messages including verbose debugging
|
|
450
|
+
|
|
451
|
+
### What Gets Logged
|
|
452
|
+
|
|
453
|
+
With debug logging enabled, you'll see detailed information about:
|
|
454
|
+
|
|
455
|
+
#### User Operations
|
|
456
|
+
- User creation attempts and results
|
|
457
|
+
- User lookup operations
|
|
458
|
+
- Identity creation and linking
|
|
459
|
+
- User validation steps
|
|
460
|
+
|
|
461
|
+
#### Authentication Operations
|
|
462
|
+
- Login attempts with provider information
|
|
463
|
+
- Signup processes step-by-step
|
|
464
|
+
- Token generation and validation
|
|
465
|
+
- Session creation and management
|
|
466
|
+
- MFA verification processes
|
|
467
|
+
|
|
468
|
+
#### Tenant Operations
|
|
469
|
+
- Default tenant resolution
|
|
470
|
+
- Tenant creation and lookup
|
|
471
|
+
- Multi-tenant routing decisions
|
|
472
|
+
|
|
473
|
+
#### Error Handling
|
|
474
|
+
- Detailed error contexts with stack traces
|
|
475
|
+
- Input data that caused errors (sensitive data masked)
|
|
476
|
+
- Operation states when errors occurred
|
|
477
|
+
|
|
478
|
+
### Example Debug Output
|
|
479
|
+
|
|
480
|
+
```
|
|
481
|
+
[NestAuth] [2024-01-15T10:30:45.123Z] [AuthService] Entering function: signup | Data: {
|
|
482
|
+
"params": {
|
|
483
|
+
"email": "user@example.com",
|
|
484
|
+
"hasPassword": true
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
[NestAuth] [2024-01-15T10:30:45.125Z] [AuthService] Auth Operation: signup | Data: {
|
|
489
|
+
"operation": "signup",
|
|
490
|
+
"providerId": "email|phone",
|
|
491
|
+
"email": "user@example.com",
|
|
492
|
+
"resolvedTenantId": "tenant-123"
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
[NestAuth] [2024-01-15T10:30:45.127Z] [UserService] User Operation: createUser | Data: {
|
|
496
|
+
"operation": "createUser",
|
|
497
|
+
"email": true,
|
|
498
|
+
"resolvedTenantId": "tenant-123"
|
|
499
|
+
}
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Development vs Production
|
|
503
|
+
|
|
504
|
+
- **Development**: Use `debug` or `verbose` level for detailed troubleshooting
|
|
505
|
+
- **Production**: Use `error` or `warn` level, or disable entirely for performance
|
|
506
|
+
|
|
507
|
+
### Performance Considerations
|
|
508
|
+
|
|
509
|
+
Debug logging adds minimal overhead when disabled. When enabled at `debug` or `verbose` levels, there is some performance impact due to:
|
|
510
|
+
- JSON serialization of data objects
|
|
511
|
+
- Additional function calls
|
|
512
|
+
- Console I/O operations
|
|
513
|
+
|
|
514
|
+
For production use, consider using `info` level or lower.
|
|
414
515
|
|
|
415
516
|
## License
|
|
416
517
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export * from './lib/tenant';
|
|
|
8
8
|
export * from './lib/core';
|
|
9
9
|
export { AuthModuleOptions, AuthModuleAsyncOptions, AuthModuleOptionsFactory, DefaultTenantOptions } from './lib/core/interfaces/auth-module-options.interface';
|
|
10
10
|
export { AuthConfigService } from './lib/core/services/auth-config.service';
|
|
11
|
+
export { DebugLoggerService, DebugLogLevel, DebugLogOptions } from './lib/core/services/debug-logger.service';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthConfigService = void 0;
|
|
3
|
+
exports.DebugLogLevel = exports.DebugLoggerService = exports.AuthConfigService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./lib/nest-auth.module"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./lib/auth.constants"), exports);
|
|
@@ -12,4 +12,7 @@ tslib_1.__exportStar(require("./lib/tenant"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./lib/core"), exports);
|
|
13
13
|
var auth_config_service_1 = require("./lib/core/services/auth-config.service");
|
|
14
14
|
Object.defineProperty(exports, "AuthConfigService", { enumerable: true, get: function () { return auth_config_service_1.AuthConfigService; } });
|
|
15
|
+
var debug_logger_service_1 = require("./lib/core/services/debug-logger.service");
|
|
16
|
+
Object.defineProperty(exports, "DebugLoggerService", { enumerable: true, get: function () { return debug_logger_service_1.DebugLoggerService; } });
|
|
17
|
+
Object.defineProperty(exports, "DebugLogLevel", { enumerable: true, get: function () { return debug_logger_service_1.DebugLogLevel; } });
|
|
15
18
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/nest-auth/src/index.ts"],"names":[],"mappings":";;;;AAAA,iEAAuC;AAEvC,+DAAqC;AAGrC,qDAA2B;AAC3B,wDAA8B;AAC9B,qDAA2B;AAC3B,qDAA2B;AAC3B,uDAA6B;AAC7B,qDAA2B;AAM3B,+EAA4E;AAAnE,wHAAA,iBAAiB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/nest-auth/src/index.ts"],"names":[],"mappings":";;;;AAAA,iEAAuC;AAEvC,+DAAqC;AAGrC,qDAA2B;AAC3B,wDAA8B;AAC9B,qDAA2B;AAC3B,qDAA2B;AAC3B,uDAA6B;AAC7B,qDAA2B;AAM3B,+EAA4E;AAAnE,wHAAA,iBAAiB,OAAA;AAG1B,iFAA8G;AAArG,0HAAA,kBAAkB,OAAA;AAAE,qHAAA,aAAa,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signup.request.dto.js","sourceRoot":"","sources":["../../../../../../../../packages/nest-auth/src/lib/auth/dto/requests/signup.request.dto.ts"],"names":[],"mappings":";;;;AAAA,qDAAmG;AACnG,6CAAmE;AAEnE,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"signup.request.dto.js","sourceRoot":"","sources":["../../../../../../../../packages/nest-auth/src/lib/auth/dto/requests/signup.request.dto.ts"],"names":[],"mappings":";;;;AAAA,qDAAmG;AACnG,6CAAmE;AAEnE,MAAa,gBAAgB;CAyB5B;AAzBD,4CAyBC;AAlBG;IAJC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACnE,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzB,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;;+CACE;AAMf;IAJC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClE,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzB,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;+CACE;AAMf;IAJC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAChE,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;kDACI;AAKjB;IAHC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;IACxF,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;kDACK"}
|
|
@@ -5,6 +5,7 @@ import { AuthService } from '../services/auth.service';
|
|
|
5
5
|
import { BaseSessionService } from '../../session/services/base-session.service';
|
|
6
6
|
import { CookieService } from '../services/cookie.service';
|
|
7
7
|
import { AccessKeyService } from '../../user/services/access-key.service';
|
|
8
|
+
export declare const OPTIONAL_AUTH_KEY = "optional_auth";
|
|
8
9
|
export declare class NestAuthAuthGuard implements CanActivate {
|
|
9
10
|
private reflector;
|
|
10
11
|
private jwtService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NestAuthAuthGuard = void 0;
|
|
3
|
+
exports.NestAuthAuthGuard = exports.OPTIONAL_AUTH_KEY = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const auth_constants_1 = require("../../auth.constants");
|
|
@@ -13,6 +13,7 @@ const access_key_service_1 = require("../../user/services/access-key.service");
|
|
|
13
13
|
const skip_mfa_decorator_1 = require("../../core/decorators/skip-mfa.decorator");
|
|
14
14
|
const permissions_decorator_1 = require("../../core/decorators/permissions.decorator");
|
|
15
15
|
const role_decorator_1 = require("../../core/decorators/role.decorator");
|
|
16
|
+
exports.OPTIONAL_AUTH_KEY = 'optional_auth';
|
|
16
17
|
let NestAuthAuthGuard = class NestAuthAuthGuard {
|
|
17
18
|
constructor(reflector, jwtService, authService, sessionService, cookieService, accessKeyService) {
|
|
18
19
|
this.reflector = reflector;
|
|
@@ -25,86 +26,172 @@ let NestAuthAuthGuard = class NestAuthAuthGuard {
|
|
|
25
26
|
async canActivate(context) {
|
|
26
27
|
const request = context.switchToHttp().getRequest();
|
|
27
28
|
const response = context.switchToHttp().getResponse();
|
|
29
|
+
const isOptional = this.reflector.getAllAndOverride(exports.OPTIONAL_AUTH_KEY, [
|
|
30
|
+
context.getHandler(),
|
|
31
|
+
context.getClass(),
|
|
32
|
+
]);
|
|
33
|
+
request['user'] = null;
|
|
34
|
+
request['session'] = null;
|
|
35
|
+
request['accessKey'] = null;
|
|
36
|
+
request['authType'] = null;
|
|
28
37
|
const authHeader = request.headers.authorization;
|
|
29
38
|
if (!authHeader) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
if (isOptional) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new common_1.UnauthorizedException({
|
|
44
|
+
message: 'No authentication provided',
|
|
45
|
+
code: 'NO_AUTH'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
34
48
|
}
|
|
35
49
|
const [type, token] = authHeader.split(' ');
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case 'apikey':
|
|
42
|
-
isAuthenticated = await this.handleApiKeyAuth(request, token);
|
|
43
|
-
break;
|
|
44
|
-
default:
|
|
50
|
+
if (!type || !token) {
|
|
51
|
+
if (isOptional) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
45
55
|
throw new common_1.UnauthorizedException({
|
|
46
|
-
message: 'Invalid authentication
|
|
47
|
-
code: '
|
|
56
|
+
message: 'Invalid authentication format',
|
|
57
|
+
code: 'INVALID_AUTH_FORMAT'
|
|
48
58
|
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let isAuthenticated = false;
|
|
62
|
+
try {
|
|
63
|
+
switch (type.toLowerCase()) {
|
|
64
|
+
case 'bearer':
|
|
65
|
+
isAuthenticated = await this.handleJwtAuth(context, request, response, token, isOptional);
|
|
66
|
+
break;
|
|
67
|
+
case 'apikey':
|
|
68
|
+
isAuthenticated = await this.handleApiKeyAuth(request, token, isOptional);
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
if (isOptional) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
throw new common_1.UnauthorizedException({
|
|
76
|
+
message: 'Invalid authentication type',
|
|
77
|
+
code: 'INVALID_AUTH_TYPE'
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
if (isOptional) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
49
89
|
}
|
|
50
|
-
if (!isAuthenticated) {
|
|
90
|
+
if (!isAuthenticated && !isOptional) {
|
|
51
91
|
return false;
|
|
52
92
|
}
|
|
53
|
-
|
|
93
|
+
if (isAuthenticated && request['user']) {
|
|
94
|
+
await this.checkAuthorization(context, request);
|
|
95
|
+
}
|
|
54
96
|
return true;
|
|
55
97
|
}
|
|
56
|
-
async handleJwtAuth(context, request, response, token) {
|
|
98
|
+
async handleJwtAuth(context, request, response, token, isOptional = false) {
|
|
57
99
|
try {
|
|
58
100
|
const payload = await this.jwtService.verifyToken(token);
|
|
59
101
|
request['user'] = payload;
|
|
60
102
|
request['authType'] = 'jwt';
|
|
61
103
|
const session = await this.sessionService.getSession(payload.sessionId);
|
|
62
104
|
if (!session) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
105
|
+
if (isOptional) {
|
|
106
|
+
request['user'] = null;
|
|
107
|
+
request['authType'] = null;
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
throw new common_1.UnauthorizedException({
|
|
112
|
+
message: 'Session not found',
|
|
113
|
+
code: auth_constants_1.UNAUTHORIZED_EXCEPTION_CODE
|
|
114
|
+
});
|
|
115
|
+
}
|
|
67
116
|
}
|
|
68
117
|
request['session'] = session;
|
|
69
|
-
await this.checkMfa(context, payload);
|
|
118
|
+
await this.checkMfa(context, payload, isOptional);
|
|
70
119
|
return true;
|
|
71
120
|
}
|
|
72
121
|
catch (error) {
|
|
73
122
|
const refreshToken = this.extractRefreshToken(request);
|
|
74
123
|
if (!refreshToken) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
124
|
+
if (isOptional) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
throw new common_1.UnauthorizedException({
|
|
129
|
+
message: 'Invalid token',
|
|
130
|
+
code: auth_constants_1.UNAUTHORIZED_EXCEPTION_CODE
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const newSession = await this.authService.refreshToken(refreshToken);
|
|
136
|
+
this.cookieService.setTokens(response, newSession.accessToken, newSession.refreshToken);
|
|
137
|
+
const payload = await this.jwtService.verifyToken(newSession.accessToken);
|
|
138
|
+
request['user'] = payload;
|
|
139
|
+
request['session'] = newSession;
|
|
140
|
+
request['authType'] = 'jwt';
|
|
141
|
+
await this.checkMfa(context, payload, isOptional);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
catch (refreshError) {
|
|
145
|
+
if (isOptional) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
throw refreshError;
|
|
150
|
+
}
|
|
79
151
|
}
|
|
80
|
-
const newSession = await this.authService.refreshToken(refreshToken);
|
|
81
|
-
this.cookieService.setTokens(response, newSession.accessToken, newSession.refreshToken);
|
|
82
|
-
const payload = await this.jwtService.verifyToken(newSession.accessToken);
|
|
83
|
-
await this.checkMfa(context, payload);
|
|
84
|
-
return true;
|
|
85
152
|
}
|
|
86
153
|
}
|
|
87
|
-
async handleApiKeyAuth(request, token) {
|
|
154
|
+
async handleApiKeyAuth(request, token, isOptional = false) {
|
|
88
155
|
const [publicKey, privateKey] = token.split('.');
|
|
89
156
|
if (!publicKey || !privateKey) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
157
|
+
if (isOptional) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
throw new common_1.UnauthorizedException({
|
|
162
|
+
message: 'Invalid API key format',
|
|
163
|
+
code: 'INVALID_API_KEY_FORMAT'
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const isValid = await this.accessKeyService.validateAccessKey(publicKey, privateKey);
|
|
169
|
+
if (!isValid) {
|
|
170
|
+
if (isOptional) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
throw new common_1.UnauthorizedException({
|
|
175
|
+
message: 'Invalid API key',
|
|
176
|
+
code: 'INVALID_API_KEY'
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const accessKey = await this.accessKeyService.getAccessKey(publicKey);
|
|
181
|
+
await this.accessKeyService.updateAccessKeyLastUsed(publicKey);
|
|
182
|
+
request['user'] = accessKey.user;
|
|
183
|
+
request['accessKey'] = accessKey;
|
|
184
|
+
request['authType'] = 'api-key';
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (isOptional) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
108
195
|
}
|
|
109
196
|
extractRefreshToken(request) {
|
|
110
197
|
const tokenFromCookie = request.cookies?.[auth_constants_1.REFRESH_TOKEN_COOKIE_NAME];
|
|
@@ -117,7 +204,7 @@ let NestAuthAuthGuard = class NestAuthAuthGuard {
|
|
|
117
204
|
}
|
|
118
205
|
return null;
|
|
119
206
|
}
|
|
120
|
-
async checkMfa(context, payload) {
|
|
207
|
+
async checkMfa(context, payload, isOptional = false) {
|
|
121
208
|
const skipMfa = this.reflector.getAllAndOverride(skip_mfa_decorator_1.SKIP_MFA_KEY, [
|
|
122
209
|
context.getHandler(),
|
|
123
210
|
context.getClass(),
|
|
@@ -125,10 +212,15 @@ let NestAuthAuthGuard = class NestAuthAuthGuard {
|
|
|
125
212
|
const isMfaEnabled = payload.isMfaEnabled;
|
|
126
213
|
const isMfaVerified = payload.isMfaVerified;
|
|
127
214
|
if (isMfaEnabled && !isMfaVerified && !skipMfa) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
215
|
+
if (isOptional) {
|
|
216
|
+
throw new Error('MFA verification required - cannot proceed with optional auth');
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
throw new common_1.UnauthorizedException({
|
|
220
|
+
message: 'Multi-factor authentication is required',
|
|
221
|
+
code: auth_constants_1.UNAUTHORIZED_EXCEPTION_CODE
|
|
222
|
+
});
|
|
223
|
+
}
|
|
132
224
|
}
|
|
133
225
|
}
|
|
134
226
|
async checkAuthorization(context, request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/auth/guards/auth.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAAsH;AACtH,yDAA8F;AAC9F,uCAAyC;AAEzC,iEAA6D;AAC7D,2DAAuD;AACvD,sFAAiF;AACjF,+DAA2D;AAC3D,+EAA0E;AAE1E,iFAAwE;AACxE,uFAA8E;AAC9E,yEAAiE;
|
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/auth/guards/auth.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAAsH;AACtH,yDAA8F;AAC9F,uCAAyC;AAEzC,iEAA6D;AAC7D,2DAAuD;AACvD,sFAAiF;AACjF,+DAA2D;AAC3D,+EAA0E;AAE1E,iFAAwE;AACxE,uFAA8E;AAC9E,yEAAiE;AAGpD,QAAA,iBAAiB,GAAG,eAAe,CAAC;AAG1C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC1B,YACY,SAAoB,EACpB,UAAsB,EACtB,WAAwB,EACxB,cAAkC,EAClC,aAA4B,EAC5B,gBAAkC;QALlC,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAoB;QAClC,kBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAkB;IAC1C,CAAC;IAEL,KAAK,CAAC,WAAW,CAAC,OAAyB;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAW,CAAC;QAC7D,MAAM,QAAQ,GAAG,OAA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AAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ,CAAA;AArYY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;6CAGc,gBAAS;QACR,wBAAU;QACT,0BAAW;QACR,yCAAkB;QACnB,8BAAa;QACV,qCAAgB;GAPrC,iBAAiB,CAqY7B"}
|
|
@@ -14,6 +14,7 @@ import { ForgotPasswordRequestDto } from '../dto/requests/forgot-password.reques
|
|
|
14
14
|
import { ResetPasswordRequestDto } from '../dto/requests/reset-password.request.dto';
|
|
15
15
|
import { AuthProviderRegistryService } from '../../core/services/auth-provider-registry.service';
|
|
16
16
|
import { TenantService } from '../../tenant/services/tenant.service';
|
|
17
|
+
import { DebugLoggerService } from '../../core/services/debug-logger.service';
|
|
17
18
|
export declare class AuthService {
|
|
18
19
|
private readonly userRepository;
|
|
19
20
|
private otpRepository;
|
|
@@ -23,7 +24,8 @@ export declare class AuthService {
|
|
|
23
24
|
private readonly jwtService;
|
|
24
25
|
private readonly eventEmitter;
|
|
25
26
|
private readonly tenantService;
|
|
26
|
-
|
|
27
|
+
private readonly debugLogger;
|
|
28
|
+
constructor(userRepository: Repository<NestAuthUser>, otpRepository: Repository<NestAuthOTP>, authProviderRegistry: AuthProviderRegistryService, mfaService: MfaService, sessionService: BaseSessionService, jwtService: JwtService, eventEmitter: EventEmitter2, tenantService: TenantService, debugLogger: DebugLoggerService);
|
|
27
29
|
getUserWithRolesAndPermissions(userId: string, relations?: string[]): Promise<NestAuthUser>;
|
|
28
30
|
getUser(): Promise<NestAuthUser>;
|
|
29
31
|
signup(input: SignupRequestDto): Promise<AuthResponseDto>;
|