@dismissible/nestjs-jwt-auth-hook 0.0.1 → 0.0.2-canary.43c6bbd.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/package.json +26 -13
- package/src/index.js +8 -0
- package/src/index.js.map +1 -0
- package/src/jwt-auth-hook.config.d.ts +50 -0
- package/src/jwt-auth-hook.config.js +69 -0
- package/src/jwt-auth-hook.config.js.map +1 -0
- package/src/jwt-auth-hook.module.d.ts +41 -0
- package/src/jwt-auth-hook.module.js +78 -0
- package/src/jwt-auth-hook.module.js.map +1 -0
- package/src/jwt-auth.hook.d.ts +21 -0
- package/src/jwt-auth.hook.js +79 -0
- package/src/jwt-auth.hook.js.map +1 -0
- package/src/jwt-auth.service.d.ts +47 -0
- package/src/jwt-auth.service.js +143 -0
- package/src/jwt-auth.service.js.map +1 -0
- package/jest.config.ts +0 -27
- package/project.json +0 -42
- package/src/jwt-auth-hook.config.spec.ts +0 -158
- package/src/jwt-auth-hook.config.ts +0 -94
- package/src/jwt-auth-hook.module.ts +0 -79
- package/src/jwt-auth.hook.spec.ts +0 -283
- package/src/jwt-auth.hook.ts +0 -99
- package/src/jwt-auth.service.spec.ts +0 -566
- package/src/jwt-auth.service.ts +0 -186
- package/tsconfig.json +0 -16
- package/tsconfig.lib.json +0 -14
- package/tsconfig.spec.json +0 -12
- /package/src/{index.ts → index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dismissible/nestjs-jwt-auth-hook",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-canary.43c6bbd.0",
|
|
4
4
|
"description": "JWT authentication hook for Dismissible applications using OIDC well-known discovery",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -11,31 +11,43 @@
|
|
|
11
11
|
"types": "./src/index.d.ts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
19
|
+
"@nestjs/axios": "^4.0.1",
|
|
20
|
+
"@dismissible/nestjs-dismissible-hooks": "^0.0.2-canary.43c6bbd.0",
|
|
21
|
+
"@dismissible/nestjs-dismissible-request": "^0.0.2-canary.43c6bbd.0",
|
|
22
|
+
"@dismissible/nestjs-logger": "^0.0.2-canary.43c6bbd.0",
|
|
23
|
+
"@dismissible/nestjs-validation": "^0.0.2-canary.43c6bbd.0",
|
|
24
|
+
"jwks-rsa": "^3.2.0",
|
|
25
|
+
"jsonwebtoken": "^9.0.3"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/jsonwebtoken": "^9.0.10"
|
|
17
29
|
},
|
|
18
30
|
"peerDependencies": {
|
|
19
|
-
"@nestjs/axios": "^4.0.0",
|
|
20
31
|
"@nestjs/common": "^11.0.0",
|
|
21
32
|
"@nestjs/core": "^11.0.0",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
33
|
+
"class-validator": "^0.14.0",
|
|
34
|
+
"class-transformer": "^0.5.0",
|
|
35
|
+
"rxjs": "^7.8.2"
|
|
24
36
|
},
|
|
25
37
|
"peerDependenciesMeta": {
|
|
26
|
-
"@nestjs/axios": {
|
|
27
|
-
"optional": false
|
|
28
|
-
},
|
|
29
38
|
"@nestjs/common": {
|
|
30
39
|
"optional": false
|
|
31
40
|
},
|
|
32
41
|
"@nestjs/core": {
|
|
33
42
|
"optional": false
|
|
34
43
|
},
|
|
35
|
-
"
|
|
44
|
+
"class-validator": {
|
|
36
45
|
"optional": false
|
|
37
46
|
},
|
|
38
|
-
"
|
|
47
|
+
"class-transformer": {
|
|
48
|
+
"optional": false
|
|
49
|
+
},
|
|
50
|
+
"rxjs": {
|
|
39
51
|
"optional": false
|
|
40
52
|
}
|
|
41
53
|
},
|
|
@@ -56,5 +68,6 @@
|
|
|
56
68
|
},
|
|
57
69
|
"publishConfig": {
|
|
58
70
|
"access": "public"
|
|
59
|
-
}
|
|
60
|
-
|
|
71
|
+
},
|
|
72
|
+
"type": "commonjs"
|
|
73
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./jwt-auth-hook.config"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./jwt-auth-hook.module"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./jwt-auth.hook"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./jwt-auth.service"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/jwt-auth-hook/src/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,iEAAuC;AACvC,0DAAgC;AAChC,6DAAmC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injection token for JWT auth hook configuration.
|
|
3
|
+
*/
|
|
4
|
+
export declare const JWT_AUTH_HOOK_CONFIG: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for JWT authentication hook.
|
|
7
|
+
*/
|
|
8
|
+
export declare class JwtAuthHookConfig {
|
|
9
|
+
readonly enabled: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The OpenID Connect well-known URL (e.g., https://auth.example.com/.well-known/openid-configuration).
|
|
12
|
+
* The JWKS URI will be fetched from this endpoint.
|
|
13
|
+
*/
|
|
14
|
+
readonly wellKnownUrl: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional: Expected issuer claim (iss) to validate.
|
|
17
|
+
* If not provided, issuer validation is skipped.
|
|
18
|
+
*/
|
|
19
|
+
readonly issuer?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional: Expected audience claim (aud) to validate.
|
|
22
|
+
* If not provided, audience validation is skipped.
|
|
23
|
+
*/
|
|
24
|
+
readonly audience?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional: Allowed algorithms for JWT verification.
|
|
27
|
+
* Defaults to ['RS256'].
|
|
28
|
+
*/
|
|
29
|
+
readonly algorithms?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Optional: Cache duration in milliseconds for JWKS.
|
|
32
|
+
* Defaults to 600000 (10 minutes).
|
|
33
|
+
*/
|
|
34
|
+
readonly jwksCacheDuration?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Optional: Request timeout in milliseconds.
|
|
37
|
+
* Defaults to 30000 (30 seconds).
|
|
38
|
+
*/
|
|
39
|
+
readonly requestTimeout?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Optional: Hook priority (lower numbers run first).
|
|
42
|
+
* Defaults to -100 (runs early for authentication).
|
|
43
|
+
*/
|
|
44
|
+
readonly priority?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Optional: Verify that the userId parameter matches the JWT subject (sub) claim.
|
|
47
|
+
* Defaults to true for security. Set to false for service-to-service scenarios.
|
|
48
|
+
*/
|
|
49
|
+
readonly verifyUserIdMatch?: boolean;
|
|
50
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JwtAuthHookConfig = exports.JWT_AUTH_HOOK_CONFIG = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const class_transformer_1 = require("class-transformer");
|
|
7
|
+
const nestjs_validation_1 = require("@dismissible/nestjs-validation");
|
|
8
|
+
/**
|
|
9
|
+
* Injection token for JWT auth hook configuration.
|
|
10
|
+
*/
|
|
11
|
+
exports.JWT_AUTH_HOOK_CONFIG = Symbol('JWT_AUTH_HOOK_CONFIG');
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for JWT authentication hook.
|
|
14
|
+
*/
|
|
15
|
+
class JwtAuthHookConfig {
|
|
16
|
+
}
|
|
17
|
+
exports.JwtAuthHookConfig = JwtAuthHookConfig;
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, class_validator_1.IsBoolean)(),
|
|
20
|
+
(0, nestjs_validation_1.TransformBoolean)(),
|
|
21
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
22
|
+
], JwtAuthHookConfig.prototype, "enabled", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, class_validator_1.ValidateIf)((o) => o.enabled === true),
|
|
25
|
+
(0, class_validator_1.IsUrl)(),
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
27
|
+
], JwtAuthHookConfig.prototype, "wellKnownUrl", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
|
30
|
+
(0, class_validator_1.IsString)(),
|
|
31
|
+
tslib_1.__metadata("design:type", String)
|
|
32
|
+
], JwtAuthHookConfig.prototype, "issuer", void 0);
|
|
33
|
+
tslib_1.__decorate([
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
tslib_1.__metadata("design:type", String)
|
|
37
|
+
], JwtAuthHookConfig.prototype, "audience", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
(0, class_validator_1.IsArray)(),
|
|
41
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
42
|
+
tslib_1.__metadata("design:type", Array)
|
|
43
|
+
], JwtAuthHookConfig.prototype, "algorithms", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.IsNumber)(),
|
|
47
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
48
|
+
tslib_1.__metadata("design:type", Number)
|
|
49
|
+
], JwtAuthHookConfig.prototype, "jwksCacheDuration", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_validator_1.IsNumber)(),
|
|
53
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
54
|
+
tslib_1.__metadata("design:type", Number)
|
|
55
|
+
], JwtAuthHookConfig.prototype, "requestTimeout", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, class_validator_1.IsOptional)(),
|
|
58
|
+
(0, class_validator_1.IsNumber)(),
|
|
59
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
60
|
+
tslib_1.__metadata("design:type", Number)
|
|
61
|
+
], JwtAuthHookConfig.prototype, "priority", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, class_validator_1.IsOptional)(),
|
|
64
|
+
(0, class_validator_1.IsBoolean)(),
|
|
65
|
+
(0, nestjs_validation_1.TransformBoolean)(true) // Default to true if not provided
|
|
66
|
+
,
|
|
67
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
68
|
+
], JwtAuthHookConfig.prototype, "verifyUserIdMatch", void 0);
|
|
69
|
+
//# sourceMappingURL=jwt-auth-hook.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-auth-hook.config.js","sourceRoot":"","sources":["../../../../libs/jwt-auth-hook/src/jwt-auth-hook.config.ts"],"names":[],"mappings":";;;;AAAA,qDAQyB;AACzB,yDAAyC;AACzC,sEAAkE;AAElE;;GAEG;AACU,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAa,iBAAiB;CAyE7B;AAzED,8CAyEC;AAtEiB;IAFf,IAAA,2BAAS,GAAE;IACX,IAAA,oCAAgB,GAAE;;kDACe;AAQlB;IAFf,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC;IACrC,IAAA,uBAAK,GAAE;;uDAC8B;AAQtB;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;iDACqB;AAQhB;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;mDACuB;AASlB;IAHf,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;qDACa;AAStB;IAHf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;4DACwB;AAS3B;IAHf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;yDACqB;AASxB;IAHf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;mDACe;AASlB;IAHf,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,oCAAgB,EAAC,IAAI,CAAC,CAAC,kCAAkC;;;4DACd"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DynamicModule, InjectionToken } from '@nestjs/common';
|
|
2
|
+
import { JwtAuthHookConfig } from './jwt-auth-hook.config';
|
|
3
|
+
/**
|
|
4
|
+
* Async module options for JWT auth hook.
|
|
5
|
+
*/
|
|
6
|
+
export interface IJwtAuthHookModuleAsyncOptions {
|
|
7
|
+
useFactory: (...args: unknown[]) => JwtAuthHookConfig | Promise<JwtAuthHookConfig>;
|
|
8
|
+
inject?: InjectionToken[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Module that provides JWT authentication hook for Dismissible.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { DismissibleModule } from '@dismissible/nestjs-dismissible';
|
|
16
|
+
* import { JwtAuthHookModule, JwtAuthHook } from '@dismissible/nestjs-jwt-auth-hook';
|
|
17
|
+
*
|
|
18
|
+
* @Module({
|
|
19
|
+
* imports: [
|
|
20
|
+
* JwtAuthHookModule.forRoot({
|
|
21
|
+
* wellKnownUrl: 'https://auth.example.com/.well-known/openid-configuration',
|
|
22
|
+
* issuer: 'https://auth.example.com',
|
|
23
|
+
* audience: 'my-api',
|
|
24
|
+
* }),
|
|
25
|
+
* DismissibleModule.forRoot({
|
|
26
|
+
* hooks: [JwtAuthHook],
|
|
27
|
+
* // ... other options
|
|
28
|
+
* }),
|
|
29
|
+
* ],
|
|
30
|
+
* })
|
|
31
|
+
* export class AppModule {}
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class JwtAuthHookModule {
|
|
35
|
+
static forRoot(config: JwtAuthHookConfig): DynamicModule;
|
|
36
|
+
/**
|
|
37
|
+
* Create module with async configuration.
|
|
38
|
+
* Useful when config values come from environment or other async sources.
|
|
39
|
+
*/
|
|
40
|
+
static forRootAsync(options: IJwtAuthHookModuleAsyncOptions): DynamicModule;
|
|
41
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var JwtAuthHookModule_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.JwtAuthHookModule = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const axios_1 = require("@nestjs/axios");
|
|
8
|
+
const jwt_auth_hook_1 = require("./jwt-auth.hook");
|
|
9
|
+
const jwt_auth_service_1 = require("./jwt-auth.service");
|
|
10
|
+
const jwt_auth_hook_config_1 = require("./jwt-auth-hook.config");
|
|
11
|
+
/**
|
|
12
|
+
* Module that provides JWT authentication hook for Dismissible.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { DismissibleModule } from '@dismissible/nestjs-dismissible';
|
|
17
|
+
* import { JwtAuthHookModule, JwtAuthHook } from '@dismissible/nestjs-jwt-auth-hook';
|
|
18
|
+
*
|
|
19
|
+
* @Module({
|
|
20
|
+
* imports: [
|
|
21
|
+
* JwtAuthHookModule.forRoot({
|
|
22
|
+
* wellKnownUrl: 'https://auth.example.com/.well-known/openid-configuration',
|
|
23
|
+
* issuer: 'https://auth.example.com',
|
|
24
|
+
* audience: 'my-api',
|
|
25
|
+
* }),
|
|
26
|
+
* DismissibleModule.forRoot({
|
|
27
|
+
* hooks: [JwtAuthHook],
|
|
28
|
+
* // ... other options
|
|
29
|
+
* }),
|
|
30
|
+
* ],
|
|
31
|
+
* })
|
|
32
|
+
* export class AppModule {}
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
let JwtAuthHookModule = JwtAuthHookModule_1 = class JwtAuthHookModule {
|
|
36
|
+
static forRoot(config) {
|
|
37
|
+
return {
|
|
38
|
+
module: JwtAuthHookModule_1,
|
|
39
|
+
imports: [axios_1.HttpModule],
|
|
40
|
+
providers: [
|
|
41
|
+
{
|
|
42
|
+
provide: jwt_auth_hook_config_1.JWT_AUTH_HOOK_CONFIG,
|
|
43
|
+
useValue: config,
|
|
44
|
+
},
|
|
45
|
+
jwt_auth_service_1.JwtAuthService,
|
|
46
|
+
jwt_auth_hook_1.JwtAuthHook,
|
|
47
|
+
],
|
|
48
|
+
exports: [jwt_auth_hook_1.JwtAuthHook, jwt_auth_service_1.JwtAuthService, jwt_auth_hook_config_1.JWT_AUTH_HOOK_CONFIG],
|
|
49
|
+
global: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create module with async configuration.
|
|
54
|
+
* Useful when config values come from environment or other async sources.
|
|
55
|
+
*/
|
|
56
|
+
static forRootAsync(options) {
|
|
57
|
+
return {
|
|
58
|
+
module: JwtAuthHookModule_1,
|
|
59
|
+
imports: [axios_1.HttpModule],
|
|
60
|
+
providers: [
|
|
61
|
+
{
|
|
62
|
+
provide: jwt_auth_hook_config_1.JWT_AUTH_HOOK_CONFIG,
|
|
63
|
+
useFactory: options.useFactory,
|
|
64
|
+
inject: options.inject ?? [],
|
|
65
|
+
},
|
|
66
|
+
jwt_auth_service_1.JwtAuthService,
|
|
67
|
+
jwt_auth_hook_1.JwtAuthHook,
|
|
68
|
+
],
|
|
69
|
+
exports: [jwt_auth_hook_1.JwtAuthHook, jwt_auth_service_1.JwtAuthService, jwt_auth_hook_config_1.JWT_AUTH_HOOK_CONFIG],
|
|
70
|
+
global: true,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.JwtAuthHookModule = JwtAuthHookModule;
|
|
75
|
+
exports.JwtAuthHookModule = JwtAuthHookModule = JwtAuthHookModule_1 = tslib_1.__decorate([
|
|
76
|
+
(0, common_1.Module)({})
|
|
77
|
+
], JwtAuthHookModule);
|
|
78
|
+
//# sourceMappingURL=jwt-auth-hook.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-auth-hook.module.js","sourceRoot":"","sources":["../../../../libs/jwt-auth-hook/src/jwt-auth-hook.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuE;AACvE,yCAA2C;AAC3C,mDAA8C;AAC9C,yDAAoD;AACpD,iEAAiF;AAUjF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEI,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAC5B,MAAM,CAAC,OAAO,CAAC,MAAyB;QACtC,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,OAAO,EAAE,CAAC,kBAAU,CAAC;YACrB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,2CAAoB;oBAC7B,QAAQ,EAAE,MAAM;iBACjB;gBACD,iCAAc;gBACd,2BAAW;aACZ;YACD,OAAO,EAAE,CAAC,2BAAW,EAAE,iCAAc,EAAE,2CAAoB,CAAC;YAC5D,MAAM,EAAE,IAAI;SACb,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,OAAuC;QACzD,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,OAAO,EAAE,CAAC,kBAAU,CAAC;YACrB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,2CAAoB;oBAC7B,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;iBAC7B;gBACD,iCAAc;gBACd,2BAAW;aACZ;YACD,OAAO,EAAE,CAAC,2BAAW,EAAE,iCAAc,EAAE,2CAAoB,CAAC;YAC5D,MAAM,EAAE,IAAI;SACb,CAAC;IACJ,CAAC;CACF,CAAA;AAvCY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,iBAAiB,CAuC7B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IDismissibleLifecycleHook, IHookResult } from '@dismissible/nestjs-dismissible-hooks';
|
|
2
|
+
import { IRequestContext } from '@dismissible/nestjs-dismissible-request';
|
|
3
|
+
import { IDismissibleLogger } from '@dismissible/nestjs-logger';
|
|
4
|
+
import { JwtAuthService } from './jwt-auth.service';
|
|
5
|
+
import { JwtAuthHookConfig } from './jwt-auth-hook.config';
|
|
6
|
+
/**
|
|
7
|
+
* JWT authentication hook that validates bearer tokens on every request.
|
|
8
|
+
* This hook runs during the pre-request phase and rejects unauthorized requests.
|
|
9
|
+
*/
|
|
10
|
+
export declare class JwtAuthHook implements IDismissibleLifecycleHook {
|
|
11
|
+
private readonly jwtAuthService;
|
|
12
|
+
private readonly config;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
readonly priority: number;
|
|
15
|
+
constructor(jwtAuthService: JwtAuthService, config: JwtAuthHookConfig, logger: IDismissibleLogger);
|
|
16
|
+
/**
|
|
17
|
+
* Validates the JWT bearer token from the Authorization header.
|
|
18
|
+
* Runs before any dismissible operation.
|
|
19
|
+
*/
|
|
20
|
+
onBeforeRequest(itemId: string, userId: string, context?: IRequestContext): Promise<IHookResult>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JwtAuthHook = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const nestjs_logger_1 = require("@dismissible/nestjs-logger");
|
|
7
|
+
const jwt_auth_service_1 = require("./jwt-auth.service");
|
|
8
|
+
const jwt_auth_hook_config_1 = require("./jwt-auth-hook.config");
|
|
9
|
+
/**
|
|
10
|
+
* JWT authentication hook that validates bearer tokens on every request.
|
|
11
|
+
* This hook runs during the pre-request phase and rejects unauthorized requests.
|
|
12
|
+
*/
|
|
13
|
+
let JwtAuthHook = class JwtAuthHook {
|
|
14
|
+
constructor(jwtAuthService, config, logger) {
|
|
15
|
+
this.jwtAuthService = jwtAuthService;
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.logger = logger;
|
|
18
|
+
this.priority = config.priority ?? -100;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Validates the JWT bearer token from the Authorization header.
|
|
22
|
+
* Runs before any dismissible operation.
|
|
23
|
+
*/
|
|
24
|
+
async onBeforeRequest(itemId, userId, context) {
|
|
25
|
+
if (!this.config.enabled) {
|
|
26
|
+
return { proceed: true };
|
|
27
|
+
}
|
|
28
|
+
const authorizationHeader = context?.headers['authorization'];
|
|
29
|
+
const token = this.jwtAuthService.extractBearerToken(authorizationHeader);
|
|
30
|
+
if (!token) {
|
|
31
|
+
this.logger.debug('JWT auth hook: No bearer token provided', {
|
|
32
|
+
itemId,
|
|
33
|
+
userId,
|
|
34
|
+
requestId: context?.requestId,
|
|
35
|
+
});
|
|
36
|
+
throw new common_1.UnauthorizedException('Missing or invalid bearer token');
|
|
37
|
+
}
|
|
38
|
+
const result = await this.jwtAuthService.validateToken(token);
|
|
39
|
+
if (!result.valid) {
|
|
40
|
+
this.logger.debug('JWT auth hook: Token validation failed', {
|
|
41
|
+
itemId,
|
|
42
|
+
userId,
|
|
43
|
+
requestId: context?.requestId,
|
|
44
|
+
error: result.error,
|
|
45
|
+
});
|
|
46
|
+
throw new common_1.UnauthorizedException(result.error);
|
|
47
|
+
}
|
|
48
|
+
const verifyUserIdMatch = this.config.verifyUserIdMatch ?? true;
|
|
49
|
+
if (verifyUserIdMatch && result.payload?.sub) {
|
|
50
|
+
if (result.payload.sub !== userId) {
|
|
51
|
+
this.logger.debug('JWT auth hook: User ID mismatch', {
|
|
52
|
+
itemId,
|
|
53
|
+
userId,
|
|
54
|
+
requestId: context?.requestId,
|
|
55
|
+
tokenSubject: result.payload.sub,
|
|
56
|
+
});
|
|
57
|
+
throw new common_1.ForbiddenException('User ID in request does not match authenticated user');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.logger.debug('JWT auth hook: Token validated successfully', {
|
|
61
|
+
itemId,
|
|
62
|
+
userId,
|
|
63
|
+
requestId: context?.requestId,
|
|
64
|
+
subject: result.payload?.sub,
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
proceed: true,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.JwtAuthHook = JwtAuthHook;
|
|
72
|
+
exports.JwtAuthHook = JwtAuthHook = tslib_1.__decorate([
|
|
73
|
+
(0, common_1.Injectable)(),
|
|
74
|
+
tslib_1.__param(1, (0, common_1.Inject)(jwt_auth_hook_config_1.JWT_AUTH_HOOK_CONFIG)),
|
|
75
|
+
tslib_1.__param(2, (0, common_1.Inject)(nestjs_logger_1.DISMISSIBLE_LOGGER)),
|
|
76
|
+
tslib_1.__metadata("design:paramtypes", [jwt_auth_service_1.JwtAuthService,
|
|
77
|
+
jwt_auth_hook_config_1.JwtAuthHookConfig, Object])
|
|
78
|
+
], JwtAuthHook);
|
|
79
|
+
//# sourceMappingURL=jwt-auth.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-auth.hook.js","sourceRoot":"","sources":["../../../../libs/jwt-auth-hook/src/jwt-auth.hook.ts"],"names":[],"mappings":";;;;AAAA,2CAA+F;AAG/F,8DAAoF;AACpF,yDAAoD;AACpD,iEAAiF;AAEjF;;;GAGG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGtB,YACmB,cAA8B,EAE9B,MAAyB,EAEzB,MAA0B;QAJ1B,mBAAc,GAAd,cAAc,CAAgB;QAE9B,WAAM,GAAN,MAAM,CAAmB;QAEzB,WAAM,GAAN,MAAM,CAAoB;QAE3C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe,CACnB,MAAc,EACd,MAAc,EACd,OAAyB;QAEzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QAED,MAAM,mBAAmB,GAAG,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;QAE9D,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;QAE1E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,EAAE;gBAC3D,MAAM;gBACN,MAAM;gBACN,SAAS,EAAE,OAAO,EAAE,SAAS;aAC9B,CAAC,CAAC;YAEH,MAAM,IAAI,8BAAqB,CAAC,iCAAiC,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,MAAM,G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CAAkB,CAAC,CAAA;6CAHM,iCAAc;QAEtB,wCAAiB;GANjC,WAAW,CA8EvB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { HttpService } from '@nestjs/axios';
|
|
3
|
+
import { JwtAuthHookConfig } from './jwt-auth-hook.config';
|
|
4
|
+
import { IDismissibleLogger } from '@dismissible/nestjs-logger';
|
|
5
|
+
/**
|
|
6
|
+
* Decoded JWT payload.
|
|
7
|
+
*/
|
|
8
|
+
export interface IJwtPayload {
|
|
9
|
+
sub?: string;
|
|
10
|
+
iss?: string;
|
|
11
|
+
aud?: string | string[];
|
|
12
|
+
exp?: number;
|
|
13
|
+
iat?: number;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of JWT validation.
|
|
18
|
+
*/
|
|
19
|
+
export interface IJwtValidationResult {
|
|
20
|
+
valid: boolean;
|
|
21
|
+
payload?: IJwtPayload;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Service responsible for JWT validation using JWKS.
|
|
26
|
+
*/
|
|
27
|
+
export declare class JwtAuthService implements OnModuleInit {
|
|
28
|
+
private readonly httpService;
|
|
29
|
+
private readonly config;
|
|
30
|
+
private readonly logger;
|
|
31
|
+
private jwksClient;
|
|
32
|
+
private jwksUri;
|
|
33
|
+
constructor(httpService: HttpService, config: JwtAuthHookConfig, logger: IDismissibleLogger);
|
|
34
|
+
onModuleInit(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Initialize the JWKS client by fetching the well-known configuration.
|
|
37
|
+
*/
|
|
38
|
+
initializeJwksClient(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Extract the bearer token from the Authorization header.
|
|
41
|
+
*/
|
|
42
|
+
extractBearerToken(authorizationHeader: string | undefined): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Validate a JWT token.
|
|
45
|
+
*/
|
|
46
|
+
validateToken(token: string): Promise<IJwtValidationResult>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JwtAuthService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const axios_1 = require("@nestjs/axios");
|
|
7
|
+
const jwks_rsa_1 = require("jwks-rsa");
|
|
8
|
+
const jwt = tslib_1.__importStar(require("jsonwebtoken"));
|
|
9
|
+
const rxjs_1 = require("rxjs");
|
|
10
|
+
const jwt_auth_hook_config_1 = require("./jwt-auth-hook.config");
|
|
11
|
+
const nestjs_logger_1 = require("@dismissible/nestjs-logger");
|
|
12
|
+
/**
|
|
13
|
+
* Service responsible for JWT validation using JWKS.
|
|
14
|
+
*/
|
|
15
|
+
let JwtAuthService = class JwtAuthService {
|
|
16
|
+
constructor(httpService, config, logger) {
|
|
17
|
+
this.httpService = httpService;
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.logger = logger;
|
|
20
|
+
this.jwksClient = null;
|
|
21
|
+
this.jwksUri = null;
|
|
22
|
+
}
|
|
23
|
+
async onModuleInit() {
|
|
24
|
+
if (this.config.enabled) {
|
|
25
|
+
await this.initializeJwksClient();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Initialize the JWKS client by fetching the well-known configuration.
|
|
30
|
+
*/
|
|
31
|
+
async initializeJwksClient() {
|
|
32
|
+
try {
|
|
33
|
+
this.logger.debug('Fetching OpenID configuration', {
|
|
34
|
+
wellKnownUrl: this.config.wellKnownUrl,
|
|
35
|
+
});
|
|
36
|
+
const response = await (0, rxjs_1.firstValueFrom)(this.httpService.get(this.config.wellKnownUrl, {
|
|
37
|
+
timeout: this.config.requestTimeout ?? 30000,
|
|
38
|
+
}));
|
|
39
|
+
const openIdConfig = response.data;
|
|
40
|
+
if (!openIdConfig.jwks_uri) {
|
|
41
|
+
throw new Error('No jwks_uri found in OpenID configuration');
|
|
42
|
+
}
|
|
43
|
+
this.jwksUri = openIdConfig.jwks_uri;
|
|
44
|
+
this.jwksClient = new jwks_rsa_1.JwksClient({
|
|
45
|
+
jwksUri: this.jwksUri,
|
|
46
|
+
cache: true,
|
|
47
|
+
cacheMaxAge: this.config.jwksCacheDuration ?? 600000,
|
|
48
|
+
timeout: this.config.requestTimeout ?? 30000,
|
|
49
|
+
});
|
|
50
|
+
this.logger.info('JWKS client initialized successfully', {
|
|
51
|
+
jwksUri: this.jwksUri,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.logger.error('Failed to initialize JWKS client', error instanceof Error ? error : new Error(String(error)), { wellKnownUrl: this.config.wellKnownUrl });
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Extract the bearer token from the Authorization header.
|
|
61
|
+
*/
|
|
62
|
+
extractBearerToken(authorizationHeader) {
|
|
63
|
+
if (!authorizationHeader) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const parts = authorizationHeader.split(' ');
|
|
67
|
+
if (parts.length !== 2 || parts[0].toLowerCase() !== 'bearer') {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return parts[1];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate a JWT token.
|
|
74
|
+
*/
|
|
75
|
+
async validateToken(token) {
|
|
76
|
+
if (!this.jwksClient) {
|
|
77
|
+
return {
|
|
78
|
+
valid: false,
|
|
79
|
+
error: 'JWKS client not initialized',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const decoded = jwt.decode(token, { complete: true });
|
|
84
|
+
if (!decoded || typeof decoded === 'string') {
|
|
85
|
+
return {
|
|
86
|
+
valid: false,
|
|
87
|
+
error: 'Invalid token format',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const kid = decoded.header.kid;
|
|
91
|
+
if (!kid) {
|
|
92
|
+
return {
|
|
93
|
+
valid: false,
|
|
94
|
+
error: 'Token missing key ID (kid)',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
let signingKey;
|
|
98
|
+
try {
|
|
99
|
+
signingKey = await this.jwksClient.getSigningKey(kid);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return {
|
|
103
|
+
valid: false,
|
|
104
|
+
error: 'Unable to find signing key',
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const publicKey = signingKey.getPublicKey();
|
|
108
|
+
const verifyOptions = {
|
|
109
|
+
algorithms: this.config.algorithms ?? ['RS256'],
|
|
110
|
+
};
|
|
111
|
+
if (this.config.issuer) {
|
|
112
|
+
verifyOptions.issuer = this.config.issuer;
|
|
113
|
+
}
|
|
114
|
+
if (this.config.audience) {
|
|
115
|
+
verifyOptions.audience = this.config.audience;
|
|
116
|
+
}
|
|
117
|
+
const payload = jwt.verify(token, publicKey, verifyOptions);
|
|
118
|
+
return {
|
|
119
|
+
valid: true,
|
|
120
|
+
payload,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
125
|
+
this.logger.debug('Token validation failed', {
|
|
126
|
+
error: errorMessage,
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
valid: false,
|
|
130
|
+
error: errorMessage,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.JwtAuthService = JwtAuthService;
|
|
136
|
+
exports.JwtAuthService = JwtAuthService = tslib_1.__decorate([
|
|
137
|
+
(0, common_1.Injectable)(),
|
|
138
|
+
tslib_1.__param(1, (0, common_1.Inject)(jwt_auth_hook_config_1.JWT_AUTH_HOOK_CONFIG)),
|
|
139
|
+
tslib_1.__param(2, (0, common_1.Inject)(nestjs_logger_1.DISMISSIBLE_LOGGER)),
|
|
140
|
+
tslib_1.__metadata("design:paramtypes", [axios_1.HttpService,
|
|
141
|
+
jwt_auth_hook_config_1.JwtAuthHookConfig, Object])
|
|
142
|
+
], JwtAuthService);
|
|
143
|
+
//# sourceMappingURL=jwt-auth.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-auth.service.js","sourceRoot":"","sources":["../../../../libs/jwt-auth-hook/src/jwt-auth.service.ts"],"names":[],"mappings":";;;;AAAA,2CAAkE;AAClE,yCAA4C;AAC5C,uCAAkD;AAClD,0DAAoC;AACpC,+BAAsC;AACtC,iEAAiF;AACjF,8DAAoF;AAuBpF;;GAEG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IAIzB,YACmB,WAAwB,EAEzC,MAA0C,EAE1C,MAA2C;QAJ1B,gBAAW,GAAX,WAAW,CAAa;QAExB,WAAM,GAAN,MAAM,CAAmB;QAEzB,WAAM,GAAN,MAAM,CAAoB;QARrC,eAAU,GAAsB,IAAI,CAAC;QACrC,YAAO,GAAkB,IAAI,CAAC;IAQnC,CAAC;IAEJ,KAAK,CAAC,YAAY;QAChB,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,oBAAoB;QACxB,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE;gBACjD,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;aACvC,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAwB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;gBACpE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,KA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,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YAC5C,CAAC;YAED,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACzB,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YAChD,CAAC;YAED,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,CAAgB,CAAC;YAE3E,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,OAAO;aACR,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAE5E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE;gBAC3C,KAAK,EAAE,YAAY;aACpB,CAAC,CAAC;YAEH,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,YAAY;aACpB,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AArJY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAOR,mBAAA,IAAA,eAAM,EAAC,2CAAoB,CAAC,CAAA;IAE5B,mBAAA,IAAA,eAAM,EAAC,kCAAkB,CAAC,CAAA;6CAHG,mBAAW;QAEhB,wCAAiB;GAPjC,cAAc,CAqJ1B"}
|
package/jest.config.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
displayName: 'jwt-auth-hook',
|
|
3
|
-
preset: '../../jest.preset.js',
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
transform: {
|
|
6
|
-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
|
|
7
|
-
},
|
|
8
|
-
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
9
|
-
coverageDirectory: '../../coverage/libs/jwt-auth-hook',
|
|
10
|
-
collectCoverageFrom: [
|
|
11
|
-
'src/**/*.ts',
|
|
12
|
-
'!src/**/*.spec.ts',
|
|
13
|
-
'!src/**/*.interface.ts',
|
|
14
|
-
'!src/**/*.dto.ts',
|
|
15
|
-
'!src/**/*.enum.ts',
|
|
16
|
-
'!src/**/index.ts',
|
|
17
|
-
'!src/**/*.module.ts',
|
|
18
|
-
],
|
|
19
|
-
coverageThreshold: {
|
|
20
|
-
global: {
|
|
21
|
-
branches: 80,
|
|
22
|
-
functions: 80,
|
|
23
|
-
lines: 80,
|
|
24
|
-
statements: 80,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|