@zorionapp/gg-core 4.14.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/README.md +11 -0
- package/package.json +58 -0
- package/src/gg-auth/decorators/protected.decorator.d.ts +9 -0
- package/src/gg-auth/decorators/protected.decorator.js +8 -0
- package/src/gg-auth/decorators/protected.decorator.js.map +1 -0
- package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.d.ts +7 -0
- package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.js +15 -0
- package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-blocked.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-inactive.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-inactive.exception.js +17 -0
- package/src/gg-auth/exceptions/user-inactive.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-otp-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-otp-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-otp-blocked.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-password-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-password-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-password-blocked.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.js.map +1 -0
- package/src/gg-auth/gg-auth.module-options.d.ts +41 -0
- package/src/gg-auth/gg-auth.module-options.js +16 -0
- package/src/gg-auth/gg-auth.module-options.js.map +1 -0
- package/src/gg-auth/gg-auth.module.d.ts +5 -0
- package/src/gg-auth/gg-auth.module.js +68 -0
- package/src/gg-auth/gg-auth.module.js.map +1 -0
- package/src/gg-auth/guards/auth.guard.d.ts +69 -0
- package/src/gg-auth/guards/auth.guard.js +175 -0
- package/src/gg-auth/guards/auth.guard.js.map +1 -0
- package/src/gg-auth/index.d.ts +8 -0
- package/src/gg-auth/index.js +13 -0
- package/src/gg-auth/index.js.map +1 -0
- package/src/gg-auth/injectable-proxy/authorized-merchant.d.ts +10 -0
- package/src/gg-auth/injectable-proxy/authorized-merchant.js +28 -0
- package/src/gg-auth/injectable-proxy/authorized-merchant.js.map +1 -0
- package/src/gg-auth/injectable-proxy/authorized-user.d.ts +24 -0
- package/src/gg-auth/injectable-proxy/authorized-user.js +56 -0
- package/src/gg-auth/injectable-proxy/authorized-user.js.map +1 -0
- package/src/gg-auth/interfaces/authorized.interface.d.ts +5 -0
- package/src/gg-auth/interfaces/authorized.interface.js +3 -0
- package/src/gg-auth/interfaces/authorized.interface.js.map +1 -0
- package/src/gg-auth/services/auth-service.interface.d.ts +4 -0
- package/src/gg-auth/services/auth-service.interface.js +3 -0
- package/src/gg-auth/services/auth-service.interface.js.map +1 -0
- package/src/gg-auth/services/gg-bearer-auth.service.d.ts +39 -0
- package/src/gg-auth/services/gg-bearer-auth.service.js +84 -0
- package/src/gg-auth/services/gg-bearer-auth.service.js.map +1 -0
- package/src/gg-auth/services/gg-merchant-auth.service.d.ts +8 -0
- package/src/gg-auth/services/gg-merchant-auth.service.js +24 -0
- package/src/gg-auth/services/gg-merchant-auth.service.js.map +1 -0
- package/src/gg-auth/utils/get-rpc-user.util.d.ts +3 -0
- package/src/gg-auth/utils/get-rpc-user.util.js +14 -0
- package/src/gg-auth/utils/get-rpc-user.util.js.map +1 -0
- package/src/gg-cache/gg-cache.module.d.ts +4 -0
- package/src/gg-cache/gg-cache.module.js +55 -0
- package/src/gg-cache/gg-cache.module.js.map +1 -0
- package/src/gg-cache/gg-cache.service.d.ts +23 -0
- package/src/gg-cache/gg-cache.service.js +58 -0
- package/src/gg-cache/gg-cache.service.js.map +1 -0
- package/src/gg-cache/index.d.ts +2 -0
- package/src/gg-cache/index.js +6 -0
- package/src/gg-cache/index.js.map +1 -0
- package/src/gg-cache/redis.config.d.ts +6 -0
- package/src/gg-cache/redis.config.js +23 -0
- package/src/gg-cache/redis.config.js.map +1 -0
- package/src/gg-cls/gg-cls.module.d.ts +4 -0
- package/src/gg-cls/gg-cls.module.js +54 -0
- package/src/gg-cls/gg-cls.module.js.map +1 -0
- package/src/gg-cls/index.d.ts +1 -0
- package/src/gg-cls/index.js +5 -0
- package/src/gg-cls/index.js.map +1 -0
- package/src/gg-config/app.config.d.ts +16 -0
- package/src/gg-config/app.config.js +78 -0
- package/src/gg-config/app.config.js.map +1 -0
- package/src/gg-config/gg-config.module-options.d.ts +4 -0
- package/src/gg-config/gg-config.module-options.js +3 -0
- package/src/gg-config/gg-config.module-options.js.map +1 -0
- package/src/gg-config/gg-config.module.d.ts +5 -0
- package/src/gg-config/gg-config.module.js +22 -0
- package/src/gg-config/gg-config.module.js.map +1 -0
- package/src/gg-config/index.d.ts +3 -0
- package/src/gg-config/index.js +7 -0
- package/src/gg-config/index.js.map +1 -0
- package/src/gg-config/validate-config.d.ts +2 -0
- package/src/gg-config/validate-config.js +31 -0
- package/src/gg-config/validate-config.js.map +1 -0
- package/src/gg-core/gg-core-module-options.d.ts +12 -0
- package/src/gg-core/gg-core-module-options.js +3 -0
- package/src/gg-core/gg-core-module-options.js.map +1 -0
- package/src/gg-core/gg-core.middleware.d.ts +8 -0
- package/src/gg-core/gg-core.middleware.js +31 -0
- package/src/gg-core/gg-core.middleware.js.map +1 -0
- package/src/gg-core/gg-core.module.d.ts +9 -0
- package/src/gg-core/gg-core.module.js +58 -0
- package/src/gg-core/gg-core.module.js.map +1 -0
- package/src/gg-core/index.d.ts +2 -0
- package/src/gg-core/index.js +6 -0
- package/src/gg-core/index.js.map +1 -0
- package/src/gg-database/config/db-entities.config.d.ts +5 -0
- package/src/gg-database/config/db-entities.config.js +7 -0
- package/src/gg-database/config/db-entities.config.js.map +1 -0
- package/src/gg-database/config/mikroorm.config.d.ts +9 -0
- package/src/gg-database/config/mikroorm.config.js +38 -0
- package/src/gg-database/config/mikroorm.config.js.map +1 -0
- package/src/gg-database/database.adapter.d.ts +24 -0
- package/src/gg-database/database.adapter.js +50 -0
- package/src/gg-database/database.adapter.js.map +1 -0
- package/src/gg-database/database.connector.d.ts +27 -0
- package/src/gg-database/database.connector.js +54 -0
- package/src/gg-database/database.connector.js.map +1 -0
- package/src/gg-database/index.d.ts +3 -0
- package/src/gg-database/index.js +7 -0
- package/src/gg-database/index.js.map +1 -0
- package/src/gg-database/modules/mikroorm.module.d.ts +37 -0
- package/src/gg-database/modules/mikroorm.module.js +111 -0
- package/src/gg-database/modules/mikroorm.module.js.map +1 -0
- package/src/gg-errors/exception.domain-codes.d.ts +12 -0
- package/src/gg-errors/exception.domain-codes.js +17 -0
- package/src/gg-errors/exception.domain-codes.js.map +1 -0
- package/src/gg-errors/exceptions/gg.exception.d.ts +12 -0
- package/src/gg-errors/exceptions/gg.exception.js +27 -0
- package/src/gg-errors/exceptions/gg.exception.js.map +1 -0
- package/src/gg-errors/gcp-error-event.interface.d.ts +18 -0
- package/src/gg-errors/gcp-error-event.interface.js +3 -0
- package/src/gg-errors/gcp-error-event.interface.js.map +1 -0
- package/src/gg-errors/gcp-error-reporting.service.d.ts +11 -0
- package/src/gg-errors/gcp-error-reporting.service.js +71 -0
- package/src/gg-errors/gcp-error-reporting.service.js.map +1 -0
- package/src/gg-errors/gg-errors-exception.filter.d.ts +9 -0
- package/src/gg-errors/gg-errors-exception.filter.js +26 -0
- package/src/gg-errors/gg-errors-exception.filter.js.map +1 -0
- package/src/gg-errors/gg-errors.module-options.d.ts +8 -0
- package/src/gg-errors/gg-errors.module-options.js +5 -0
- package/src/gg-errors/gg-errors.module-options.js.map +1 -0
- package/src/gg-errors/gg-errors.module.d.ts +5 -0
- package/src/gg-errors/gg-errors.module.js +35 -0
- package/src/gg-errors/gg-errors.module.js.map +1 -0
- package/src/gg-errors/gg-exception.service.d.ts +50 -0
- package/src/gg-errors/gg-exception.service.js +213 -0
- package/src/gg-errors/gg-exception.service.js.map +1 -0
- package/src/gg-errors/index.d.ts +1 -0
- package/src/gg-errors/index.js +5 -0
- package/src/gg-errors/index.js.map +1 -0
- package/src/gg-gcp/gcp-trace-and-profiler.d.ts +1 -0
- package/src/gg-gcp/gcp-trace-and-profiler.js +52 -0
- package/src/gg-gcp/gcp-trace-and-profiler.js.map +1 -0
- package/src/gg-gcp/index.d.ts +1 -0
- package/src/gg-gcp/index.js +5 -0
- package/src/gg-gcp/index.js.map +1 -0
- package/src/gg-healthchecks/gg-healthchecks.controller.d.ts +7 -0
- package/src/gg-healthchecks/gg-healthchecks.controller.js +31 -0
- package/src/gg-healthchecks/gg-healthchecks.controller.js.map +1 -0
- package/src/gg-healthchecks/gg-healthchecks.module.d.ts +4 -0
- package/src/gg-healthchecks/gg-healthchecks.module.js +17 -0
- package/src/gg-healthchecks/gg-healthchecks.module.js.map +1 -0
- package/src/gg-kernel/index.d.ts +2 -0
- package/src/gg-kernel/index.js +6 -0
- package/src/gg-kernel/index.js.map +1 -0
- package/src/gg-kernel/kernel.d.ts +36 -0
- package/src/gg-kernel/kernel.js +86 -0
- package/src/gg-kernel/kernel.js.map +1 -0
- package/src/gg-kernel/service-providers/base-service-provider.d.ts +15 -0
- package/src/gg-kernel/service-providers/base-service-provider.js +25 -0
- package/src/gg-kernel/service-providers/base-service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/global-prefix.service-provider.d.ts +4 -0
- package/src/gg-kernel/service-providers/global-prefix.service-provider.js +17 -0
- package/src/gg-kernel/service-providers/global-prefix.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/helmet.service-provider.d.ts +4 -0
- package/src/gg-kernel/service-providers/helmet.service-provider.js +12 -0
- package/src/gg-kernel/service-providers/helmet.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/index.d.ts +8 -0
- package/src/gg-kernel/service-providers/index.js +12 -0
- package/src/gg-kernel/service-providers/index.js.map +1 -0
- package/src/gg-kernel/service-providers/logger.service-provider.d.ts +8 -0
- package/src/gg-kernel/service-providers/logger.service-provider.js +20 -0
- package/src/gg-kernel/service-providers/logger.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.d.ts +7 -0
- package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.js +14 -0
- package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/swagger.service-provider.d.ts +13 -0
- package/src/gg-kernel/service-providers/swagger.service-provider.js +35 -0
- package/src/gg-kernel/service-providers/swagger.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/validation.service-provider.d.ts +10 -0
- package/src/gg-kernel/service-providers/validation.service-provider.js +22 -0
- package/src/gg-kernel/service-providers/validation.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/versioning.service-provider.d.ts +10 -0
- package/src/gg-kernel/service-providers/versioning.service-provider.js +17 -0
- package/src/gg-kernel/service-providers/versioning.service-provider.js.map +1 -0
- package/src/gg-logger/gg-logger.module.d.ts +4 -0
- package/src/gg-logger/gg-logger.module.js +48 -0
- package/src/gg-logger/gg-logger.module.js.map +1 -0
- package/src/gg-metrics/gg-metrics.controller.d.ts +3 -0
- package/src/gg-metrics/gg-metrics.controller.js +15 -0
- package/src/gg-metrics/gg-metrics.controller.js.map +1 -0
- package/src/gg-metrics/gg-metrics.module.d.ts +4 -0
- package/src/gg-metrics/gg-metrics.module.js +31 -0
- package/src/gg-metrics/gg-metrics.module.js.map +1 -0
- package/src/gg-metrics/index.d.ts +1 -0
- package/src/gg-metrics/index.js +5 -0
- package/src/gg-metrics/index.js.map +1 -0
- package/src/gg-micro/gg-micro.module.d.ts +5 -0
- package/src/gg-micro/gg-micro.module.js +62 -0
- package/src/gg-micro/gg-micro.module.js.map +1 -0
- package/src/gg-micro/gg-rmq-service.injector.d.ts +19 -0
- package/src/gg-micro/gg-rmq-service.injector.js +29 -0
- package/src/gg-micro/gg-rmq-service.injector.js.map +1 -0
- package/src/gg-micro/gg-rmq.configurator.d.ts +16 -0
- package/src/gg-micro/gg-rmq.configurator.js +34 -0
- package/src/gg-micro/gg-rmq.configurator.js.map +1 -0
- package/src/gg-micro/index.d.ts +4 -0
- package/src/gg-micro/index.js +8 -0
- package/src/gg-micro/index.js.map +1 -0
- package/src/gg-micro/micro.client.d.ts +62 -0
- package/src/gg-micro/micro.client.js +101 -0
- package/src/gg-micro/micro.client.js.map +1 -0
- package/src/gg-micro/rmq.config.d.ts +10 -0
- package/src/gg-micro/rmq.config.js +50 -0
- package/src/gg-micro/rmq.config.js.map +1 -0
- package/src/gg-micro/rmq.connector.d.ts +12 -0
- package/src/gg-micro/rmq.connector.js +25 -0
- package/src/gg-micro/rmq.connector.js.map +1 -0
- package/src/gg-micro/rmq.queue-map.d.ts +2 -0
- package/src/gg-micro/rmq.queue-map.js +24 -0
- package/src/gg-micro/rmq.queue-map.js.map +1 -0
- package/src/gg-throttler/gg-throttler.module-options.d.ts +4 -0
- package/src/gg-throttler/gg-throttler.module-options.js +3 -0
- package/src/gg-throttler/gg-throttler.module-options.js.map +1 -0
- package/src/gg-throttler/gg-throttler.module.d.ts +5 -0
- package/src/gg-throttler/gg-throttler.module.js +24 -0
- package/src/gg-throttler/gg-throttler.module.js.map +1 -0
- package/src/gg-throttler/throttler.guard.d.ts +13 -0
- package/src/gg-throttler/throttler.guard.js +28 -0
- package/src/gg-throttler/throttler.guard.js.map +1 -0
- package/src/index.d.ts +10 -0
- package/src/index.js +14 -0
- package/src/index.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zorionapp/gg-core",
|
|
3
|
+
"version": "4.14.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"cache-manager": "5.2.4",
|
|
7
|
+
"@google-cloud/error-reporting": "3.0.5",
|
|
8
|
+
"@google-cloud/profiler": "6.0.0",
|
|
9
|
+
"@google-cloud/trace-agent": "7.1.2"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"cache-manager-redis-yet": "^4.1.2",
|
|
13
|
+
"amqp-connection-manager": "^4.1.14",
|
|
14
|
+
"amqplib": "^0.10.3",
|
|
15
|
+
"redis": "^4.6.10",
|
|
16
|
+
"helmet": "^7.1.0",
|
|
17
|
+
"pino-http": "^8.5.0",
|
|
18
|
+
"@google-cloud/error-reporting": "^3.0.5",
|
|
19
|
+
"@google-cloud/profiler": "^6.0.0",
|
|
20
|
+
"@google-cloud/trace-agent": "^7.1.2",
|
|
21
|
+
"@horizon-republic/nominal-types": "^2.0.14",
|
|
22
|
+
"@mikro-orm/core": "^5.0.0 || ^6.0.0",
|
|
23
|
+
"@mikro-orm/migrations": "^6.2.8",
|
|
24
|
+
"@mikro-orm/nestjs": "^6.0.1",
|
|
25
|
+
"@mikro-orm/postgresql": "^6.2.8",
|
|
26
|
+
"@mikro-orm/seeder": "^6.2.8",
|
|
27
|
+
"@nestjs/axios": "^3.0.0",
|
|
28
|
+
"@nestjs/cache-manager": "^2.0.0",
|
|
29
|
+
"@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
30
|
+
"@nestjs/config": "^3.0.0",
|
|
31
|
+
"@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
32
|
+
"@nestjs/microservices": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
33
|
+
"@nestjs/platform-express": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
34
|
+
"@nestjs/swagger": "^6.0.0 || ^7.0.0",
|
|
35
|
+
"@nestjs/terminus": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
36
|
+
"@nestjs/throttler": "^3.0.0 || ^4.0.0",
|
|
37
|
+
"@willsoto/nestjs-prometheus": "^5.5.1",
|
|
38
|
+
"axios": "^1.0.0",
|
|
39
|
+
"class-transformer": "^0.5.1",
|
|
40
|
+
"class-transformer-validator": "^0.9.1",
|
|
41
|
+
"class-validator": "^0.14.0",
|
|
42
|
+
"express": "^4.18.0",
|
|
43
|
+
"get-root-path": "^2.0.2",
|
|
44
|
+
"lodash": "^4.17.0",
|
|
45
|
+
"luxon": "^3.4.0",
|
|
46
|
+
"mathjs": "^11.0.0 || ^12.0.0 || ^13.0.0",
|
|
47
|
+
"nestjs-cls": "^3.0.0",
|
|
48
|
+
"nestjs-pino": "^3.3.0",
|
|
49
|
+
"pino-pretty": "^10.2.0",
|
|
50
|
+
"prom-client": "^14.2.0",
|
|
51
|
+
"rxjs": "^7.8.1",
|
|
52
|
+
"ts-enum-util": "^4.0.2",
|
|
53
|
+
"uuid": "^9.0.0",
|
|
54
|
+
"yaml": "^2.3.1",
|
|
55
|
+
"kutt": "^3.0.2"
|
|
56
|
+
},
|
|
57
|
+
"main": "./src/index.js"
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { User } from '@zorionapp/gg-toolkit/enum';
|
|
2
|
+
import { AuthType } from '../gg-auth.module-options';
|
|
3
|
+
type ProtectedOptions = {
|
|
4
|
+
roles?: User.Role[];
|
|
5
|
+
authTypes?: AuthType[];
|
|
6
|
+
allowedUserStatuses?: User.Status[];
|
|
7
|
+
};
|
|
8
|
+
export declare const Protected: (options?: ProtectedOptions) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Protected = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const gg_auth_module_options_1 = require("../gg-auth.module-options");
|
|
6
|
+
const Protected = (options = { roles: [], authTypes: [gg_auth_module_options_1.AuthType.Bearer], allowedUserStatuses: [] }) => (0, common_1.applyDecorators)((0, common_1.SetMetadata)(gg_auth_module_options_1.GG_AUTH_PROTECTED_TOKEN, true), (0, common_1.SetMetadata)(gg_auth_module_options_1.GG_AUTH_ROLES_TOKEN, options.roles ?? []), (0, common_1.SetMetadata)(gg_auth_module_options_1.GG_AUTH_AUTH_TYPE_TOKEN, options.authTypes ?? gg_auth_module_options_1.AuthType.Bearer), (0, common_1.SetMetadata)(gg_auth_module_options_1.GG_AUTH_ALLOWED_USER_STATUS_TOKEN, options.allowedUserStatuses ?? []));
|
|
7
|
+
exports.Protected = Protected;
|
|
8
|
+
//# sourceMappingURL=protected.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protected.decorator.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/decorators/protected.decorator.ts"],"names":[],"mappings":";;;AACA,2CAA8D;AAC9D,sEAMmC;AAI5B,MAAM,SAAS,GAAG,CACvB,UAA4B,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,iCAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,EAAE,EAAE,EAAE,EAChG,EAAE,CACF,IAAA,wBAAe,EACb,IAAA,oBAAW,EAAC,gDAAuB,EAAE,IAAI,CAAC,EAC1C,IAAA,oBAAW,EAAC,4CAAmB,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EACrD,IAAA,oBAAW,EAAC,gDAAuB,EAAE,OAAO,CAAC,SAAS,IAAI,iCAAQ,CAAC,MAAM,CAAC,EAC1E,IAAA,oBAAW,EAAC,0DAAiC,EAAE,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAClF,CAAC;AARS,QAAA,SAAS,aAQlB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExceptionDomainCodes } from '../../gg-errors/exception.domain-codes';
|
|
2
|
+
import { GgException } from '../../gg-errors/exceptions/gg.exception';
|
|
3
|
+
export declare class MerchantIpMismatchException extends GgException {
|
|
4
|
+
protected domainCode: ExceptionDomainCodes;
|
|
5
|
+
protected message: string;
|
|
6
|
+
protected internalMessage: string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MerchantIpMismatchException = void 0;
|
|
4
|
+
const exception_domain_codes_1 = require("../../gg-errors/exception.domain-codes");
|
|
5
|
+
const gg_exception_1 = require("../../gg-errors/exceptions/gg.exception");
|
|
6
|
+
class MerchantIpMismatchException extends gg_exception_1.GgException {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.domainCode = exception_domain_codes_1.ExceptionDomainCodes.MerchantIPMismatch;
|
|
10
|
+
this.message = 'Your IP is not whitelisted';
|
|
11
|
+
this.internalMessage = 'Your IP is not whitelisted';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.MerchantIpMismatchException = MerchantIpMismatchException;
|
|
15
|
+
//# sourceMappingURL=merchant-ip-mismatch.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merchant-ip-mismatch.exception.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/exceptions/merchant-ip-mismatch.exception.ts"],"names":[],"mappings":";;;AAAA,mFAA8E;AAC9E,0EAAsE;AAEtE,MAAa,2BAA4B,SAAQ,0BAAW;IAA5D;;QACY,eAAU,GAAG,6CAAoB,CAAC,kBAAkB,CAAC;QACrD,YAAO,GAAG,4BAA4B,CAAC;QACvC,oBAAe,GAAG,4BAA4B,CAAC;IAC3D,CAAC;CAAA;AAJD,kEAIC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { ExceptionDomainCodes } from '../../gg-errors/exception.domain-codes';
|
|
3
|
+
import { GgException } from '../../gg-errors/exceptions/gg.exception';
|
|
4
|
+
export declare class UserBlockedException extends GgException {
|
|
5
|
+
protected domainCode: ExceptionDomainCodes;
|
|
6
|
+
protected message: string;
|
|
7
|
+
protected internalMessage: string;
|
|
8
|
+
protected status: HttpStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserBlockedException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const exception_domain_codes_1 = require("../../gg-errors/exception.domain-codes");
|
|
6
|
+
const gg_exception_1 = require("../../gg-errors/exceptions/gg.exception");
|
|
7
|
+
class UserBlockedException extends gg_exception_1.GgException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.domainCode = exception_domain_codes_1.ExceptionDomainCodes.UserBlocked;
|
|
11
|
+
this.message = 'User blocked';
|
|
12
|
+
this.internalMessage = 'User blocked';
|
|
13
|
+
this.status = common_1.HttpStatus.FORBIDDEN;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UserBlockedException = UserBlockedException;
|
|
17
|
+
//# sourceMappingURL=user-blocked.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-blocked.exception.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/exceptions/user-blocked.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,mFAA8E;AAC9E,0EAAsE;AAEtE,MAAa,oBAAqB,SAAQ,0BAAW;IAArD;;QACY,eAAU,GAAG,6CAAoB,CAAC,WAAW,CAAC;QAC9C,YAAO,GAAG,cAAc,CAAC;QACzB,oBAAe,GAAG,cAAc,CAAC;QACjC,WAAM,GAAG,mBAAU,CAAC,SAAS,CAAC;IAC1C,CAAC;CAAA;AALD,oDAKC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { ExceptionDomainCodes } from '../../gg-errors/exception.domain-codes';
|
|
3
|
+
import { GgException } from '../../gg-errors/exceptions/gg.exception';
|
|
4
|
+
export declare class UserInactiveException extends GgException {
|
|
5
|
+
protected domainCode: ExceptionDomainCodes;
|
|
6
|
+
protected message: string;
|
|
7
|
+
protected internalMessage: string;
|
|
8
|
+
protected status: HttpStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserInactiveException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const exception_domain_codes_1 = require("../../gg-errors/exception.domain-codes");
|
|
6
|
+
const gg_exception_1 = require("../../gg-errors/exceptions/gg.exception");
|
|
7
|
+
class UserInactiveException extends gg_exception_1.GgException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.domainCode = exception_domain_codes_1.ExceptionDomainCodes.UserInactive;
|
|
11
|
+
this.message = 'User inactive';
|
|
12
|
+
this.internalMessage = 'User inactive';
|
|
13
|
+
this.status = common_1.HttpStatus.FORBIDDEN;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UserInactiveException = UserInactiveException;
|
|
17
|
+
//# sourceMappingURL=user-inactive.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-inactive.exception.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/exceptions/user-inactive.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,mFAA8E;AAC9E,0EAAsE;AAEtE,MAAa,qBAAsB,SAAQ,0BAAW;IAAtD;;QACY,eAAU,GAAG,6CAAoB,CAAC,YAAY,CAAC;QAC/C,YAAO,GAAG,eAAe,CAAC;QAC1B,oBAAe,GAAG,eAAe,CAAC;QAClC,WAAM,GAAG,mBAAU,CAAC,SAAS,CAAC;IAC1C,CAAC;CAAA;AALD,sDAKC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { ExceptionDomainCodes } from '../../gg-errors/exception.domain-codes';
|
|
3
|
+
import { GgException } from '../../gg-errors/exceptions/gg.exception';
|
|
4
|
+
export declare class UserOtpBlockedException extends GgException {
|
|
5
|
+
protected domainCode: ExceptionDomainCodes;
|
|
6
|
+
protected message: string;
|
|
7
|
+
protected internalMessage: string;
|
|
8
|
+
protected status: HttpStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserOtpBlockedException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const exception_domain_codes_1 = require("../../gg-errors/exception.domain-codes");
|
|
6
|
+
const gg_exception_1 = require("../../gg-errors/exceptions/gg.exception");
|
|
7
|
+
class UserOtpBlockedException extends gg_exception_1.GgException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.domainCode = exception_domain_codes_1.ExceptionDomainCodes.UserOTPBlocked;
|
|
11
|
+
this.message = 'User OTP blocked';
|
|
12
|
+
this.internalMessage = 'User OTP blocked';
|
|
13
|
+
this.status = common_1.HttpStatus.FORBIDDEN;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UserOtpBlockedException = UserOtpBlockedException;
|
|
17
|
+
//# sourceMappingURL=user-otp-blocked.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-otp-blocked.exception.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/exceptions/user-otp-blocked.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,mFAA8E;AAC9E,0EAAsE;AAEtE,MAAa,uBAAwB,SAAQ,0BAAW;IAAxD;;QACY,eAAU,GAAG,6CAAoB,CAAC,cAAc,CAAC;QACjD,YAAO,GAAG,kBAAkB,CAAC;QAC7B,oBAAe,GAAG,kBAAkB,CAAC;QACrC,WAAM,GAAG,mBAAU,CAAC,SAAS,CAAC;IAC1C,CAAC;CAAA;AALD,0DAKC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { ExceptionDomainCodes } from '../../gg-errors/exception.domain-codes';
|
|
3
|
+
import { GgException } from '../../gg-errors/exceptions/gg.exception';
|
|
4
|
+
export declare class UserPasswordBlockedException extends GgException {
|
|
5
|
+
protected domainCode: ExceptionDomainCodes;
|
|
6
|
+
protected message: string;
|
|
7
|
+
protected internalMessage: string;
|
|
8
|
+
protected status: HttpStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserPasswordBlockedException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const exception_domain_codes_1 = require("../../gg-errors/exception.domain-codes");
|
|
6
|
+
const gg_exception_1 = require("../../gg-errors/exceptions/gg.exception");
|
|
7
|
+
class UserPasswordBlockedException extends gg_exception_1.GgException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.domainCode = exception_domain_codes_1.ExceptionDomainCodes.UserPasswordBlocked;
|
|
11
|
+
this.message = 'User password blocked';
|
|
12
|
+
this.internalMessage = 'User password blocked';
|
|
13
|
+
this.status = common_1.HttpStatus.FORBIDDEN;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UserPasswordBlockedException = UserPasswordBlockedException;
|
|
17
|
+
//# sourceMappingURL=user-password-blocked.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-password-blocked.exception.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/exceptions/user-password-blocked.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,mFAA8E;AAC9E,0EAAsE;AAEtE,MAAa,4BAA6B,SAAQ,0BAAW;IAA7D;;QACY,eAAU,GAAG,6CAAoB,CAAC,mBAAmB,CAAC;QACtD,YAAO,GAAG,uBAAuB,CAAC;QAClC,oBAAe,GAAG,uBAAuB,CAAC;QAC1C,WAAM,GAAG,mBAAU,CAAC,SAAS,CAAC;IAC1C,CAAC;CAAA;AALD,oEAKC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { ExceptionDomainCodes } from '../../gg-errors/exception.domain-codes';
|
|
3
|
+
import { GgException } from '../../gg-errors/exceptions/gg.exception';
|
|
4
|
+
export declare class UserPasswordRecoveryBlockedException extends GgException {
|
|
5
|
+
protected domainCode: ExceptionDomainCodes;
|
|
6
|
+
protected message: string;
|
|
7
|
+
protected internalMessage: string;
|
|
8
|
+
protected status: HttpStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserPasswordRecoveryBlockedException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const exception_domain_codes_1 = require("../../gg-errors/exception.domain-codes");
|
|
6
|
+
const gg_exception_1 = require("../../gg-errors/exceptions/gg.exception");
|
|
7
|
+
class UserPasswordRecoveryBlockedException extends gg_exception_1.GgException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.domainCode = exception_domain_codes_1.ExceptionDomainCodes.UserPasswordRecoveryBlocked;
|
|
11
|
+
this.message = 'User password recovery blocked';
|
|
12
|
+
this.internalMessage = 'User password recovery blocked';
|
|
13
|
+
this.status = common_1.HttpStatus.FORBIDDEN;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UserPasswordRecoveryBlockedException = UserPasswordRecoveryBlockedException;
|
|
17
|
+
//# sourceMappingURL=user-password-recovery-blocked.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-password-recovery-blocked.exception.js","sourceRoot":"","sources":["../../../../../../libs/gg-core/src/gg-auth/exceptions/user-password-recovery-blocked.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,mFAA8E;AAC9E,0EAAsE;AAEtE,MAAa,oCAAqC,SAAQ,0BAAW;IAArE;;QACY,eAAU,GAAG,6CAAoB,CAAC,2BAA2B,CAAC;QAC9D,YAAO,GAAG,gCAAgC,CAAC;QAC3C,oBAAe,GAAG,gCAAgC,CAAC;QACnD,WAAM,GAAG,mBAAU,CAAC,SAAS,CAAC;IAC1C,CAAC;CAAA;AALD,oFAKC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { Constructor } from '@nestjs/common/utils/merge-with-values.util';
|
|
3
|
+
import { AuthService } from './services/auth-service.interface';
|
|
4
|
+
export declare const GG_AUTH_MODULE_OPTIONS_TOKEN = "GG_AUTH_MODULE_OPTIONS";
|
|
5
|
+
export declare const GG_AUTH_PROTECTED_TOKEN = "GG_AUTH_PROTECTED_TOKEN";
|
|
6
|
+
export declare const GG_AUTH_ROLES_TOKEN = "GG_AUTH_ROLES_TOKEN";
|
|
7
|
+
export declare const GG_AUTH_ALLOWED_USER_STATUS_TOKEN = "GG_AUTH_ALLOWED_USER_STATUS_TOKEN";
|
|
8
|
+
export declare const GG_AUTH_AUTH_TYPE_TOKEN = "GG_AUTH_AUTH_TYPE_TOKEN";
|
|
9
|
+
export declare const GG_AUTH_AUTH_TYPE_BEARER_TOKEN = "GG_AUTH_AUTH_TYPE_BEARER_TOKEN";
|
|
10
|
+
export declare const GG_AUTH_AUTH_TYPE_MERCHANT_TOKEN = "GG_AUTH_AUTH_TYPE_MERCHANT_TOKEN";
|
|
11
|
+
export declare enum AuthType {
|
|
12
|
+
Merchant = "merchant",
|
|
13
|
+
Bearer = "bearer"
|
|
14
|
+
}
|
|
15
|
+
export interface GgAuthOptions {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Host without http://
|
|
19
|
+
* not required with authBearerService
|
|
20
|
+
*/
|
|
21
|
+
ggUsersHost?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Host without http://
|
|
24
|
+
* not required with authBearerService
|
|
25
|
+
*/
|
|
26
|
+
ggMerchantsHost?: string;
|
|
27
|
+
}
|
|
28
|
+
interface GgAuthCustomServices {
|
|
29
|
+
/**
|
|
30
|
+
* Service that implements AuthService
|
|
31
|
+
* required without ggUsersHost
|
|
32
|
+
*/
|
|
33
|
+
authBearerService?: Constructor<AuthService>;
|
|
34
|
+
/**
|
|
35
|
+
* Service that implements AuthService
|
|
36
|
+
* required without ggMerchantsHost
|
|
37
|
+
*/
|
|
38
|
+
authMerchantService?: Constructor<AuthService>;
|
|
39
|
+
}
|
|
40
|
+
export type GgAuthModuleOptions = Pick<ModuleMetadata, 'imports' | 'providers'> & Pick<FactoryProvider<GgAuthOptions>, 'useFactory' | 'inject'> & GgAuthCustomServices;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthType = exports.GG_AUTH_AUTH_TYPE_MERCHANT_TOKEN = exports.GG_AUTH_AUTH_TYPE_BEARER_TOKEN = exports.GG_AUTH_AUTH_TYPE_TOKEN = exports.GG_AUTH_ALLOWED_USER_STATUS_TOKEN = exports.GG_AUTH_ROLES_TOKEN = exports.GG_AUTH_PROTECTED_TOKEN = exports.GG_AUTH_MODULE_OPTIONS_TOKEN = void 0;
|
|
4
|
+
exports.GG_AUTH_MODULE_OPTIONS_TOKEN = 'GG_AUTH_MODULE_OPTIONS';
|
|
5
|
+
exports.GG_AUTH_PROTECTED_TOKEN = 'GG_AUTH_PROTECTED_TOKEN';
|
|
6
|
+
exports.GG_AUTH_ROLES_TOKEN = 'GG_AUTH_ROLES_TOKEN';
|
|
7
|
+
exports.GG_AUTH_ALLOWED_USER_STATUS_TOKEN = 'GG_AUTH_ALLOWED_USER_STATUS_TOKEN';
|
|
8
|
+
exports.GG_AUTH_AUTH_TYPE_TOKEN = 'GG_AUTH_AUTH_TYPE_TOKEN';
|
|
9
|
+
exports.GG_AUTH_AUTH_TYPE_BEARER_TOKEN = 'GG_AUTH_AUTH_TYPE_BEARER_TOKEN';
|
|
10
|
+
exports.GG_AUTH_AUTH_TYPE_MERCHANT_TOKEN = 'GG_AUTH_AUTH_TYPE_MERCHANT_TOKEN';
|
|
11
|
+
var AuthType;
|
|
12
|
+
(function (AuthType) {
|
|
13
|
+
AuthType["Merchant"] = "merchant";
|
|
14
|
+
AuthType["Bearer"] = "bearer";
|
|
15
|
+
})(AuthType || (exports.AuthType = AuthType = {}));
|
|
16
|
+
//# sourceMappingURL=gg-auth.module-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gg-auth.module-options.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-auth/gg-auth.module-options.ts"],"names":[],"mappings":";;;AAIa,QAAA,4BAA4B,GAAG,wBAAwB,CAAC;AACxD,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACpD,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,iCAAiC,GAAG,mCAAmC,CAAC;AACxE,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACpD,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAClE,QAAA,gCAAgC,GAAG,kCAAkC,CAAC;AAEnF,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;AACnB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var GgAuthModule_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GgAuthModule = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const axios_1 = require("@nestjs/axios");
|
|
7
|
+
const common_1 = require("@nestjs/common");
|
|
8
|
+
const core_1 = require("@nestjs/core");
|
|
9
|
+
const lodash_1 = require("lodash");
|
|
10
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
11
|
+
const gg_auth_module_options_1 = require("./gg-auth.module-options");
|
|
12
|
+
const auth_guard_1 = require("./guards/auth.guard");
|
|
13
|
+
const authorized_merchant_1 = require("./injectable-proxy/authorized-merchant");
|
|
14
|
+
const authorized_user_1 = require("./injectable-proxy/authorized-user");
|
|
15
|
+
const gg_bearer_auth_service_1 = require("./services/gg-bearer-auth.service");
|
|
16
|
+
const gg_merchant_auth_service_1 = require("./services/gg-merchant-auth.service");
|
|
17
|
+
const authorizedUserFactory = () => {
|
|
18
|
+
return nestjs_cls_1.ClsModule.forFeatureAsync({
|
|
19
|
+
provide: authorized_user_1.AuthorizedUser,
|
|
20
|
+
imports: [],
|
|
21
|
+
inject: [],
|
|
22
|
+
useFactory: () => new authorized_user_1.AuthorizedUser(),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const authorizedMerchantFactory = () => {
|
|
26
|
+
return nestjs_cls_1.ClsModule.forFeatureAsync({
|
|
27
|
+
provide: authorized_merchant_1.AuthorizedMerchant,
|
|
28
|
+
imports: [],
|
|
29
|
+
inject: [],
|
|
30
|
+
useFactory: () => new authorized_merchant_1.AuthorizedMerchant(),
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
let GgAuthModule = GgAuthModule_1 = class GgAuthModule {
|
|
34
|
+
static forRootAsync(options) {
|
|
35
|
+
const bearerProvider = {
|
|
36
|
+
provide: gg_auth_module_options_1.GG_AUTH_AUTH_TYPE_BEARER_TOKEN,
|
|
37
|
+
useClass: options?.authBearerService ?? gg_bearer_auth_service_1.GgBearerAuthService,
|
|
38
|
+
};
|
|
39
|
+
const merchantProvider = {
|
|
40
|
+
provide: gg_auth_module_options_1.GG_AUTH_AUTH_TYPE_MERCHANT_TOKEN,
|
|
41
|
+
useClass: options?.authMerchantService ?? gg_merchant_auth_service_1.GgMerchantAuthService,
|
|
42
|
+
};
|
|
43
|
+
const providers = [
|
|
44
|
+
...(options?.providers ?? []),
|
|
45
|
+
{ provide: core_1.APP_GUARD, useClass: auth_guard_1.AuthGuard },
|
|
46
|
+
bearerProvider,
|
|
47
|
+
merchantProvider,
|
|
48
|
+
{
|
|
49
|
+
provide: gg_auth_module_options_1.GG_AUTH_MODULE_OPTIONS_TOKEN,
|
|
50
|
+
useFactory: options?.useFactory,
|
|
51
|
+
inject: options?.inject,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
const exports = [authorizedUserFactory(), authorizedMerchantFactory(), bearerProvider, merchantProvider];
|
|
55
|
+
return {
|
|
56
|
+
module: GgAuthModule_1,
|
|
57
|
+
global: true,
|
|
58
|
+
imports: (0, lodash_1.merge)(options?.imports ?? [], [axios_1.HttpModule, authorizedUserFactory(), authorizedMerchantFactory()]),
|
|
59
|
+
providers: !(0, lodash_1.isNil)(options) ? providers : [],
|
|
60
|
+
exports: !(0, lodash_1.isNil)(options) ? exports : [authorizedUserFactory(), authorizedMerchantFactory()],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.GgAuthModule = GgAuthModule;
|
|
65
|
+
exports.GgAuthModule = GgAuthModule = GgAuthModule_1 = tslib_1.__decorate([
|
|
66
|
+
(0, common_1.Module)({})
|
|
67
|
+
], GgAuthModule);
|
|
68
|
+
//# sourceMappingURL=gg-auth.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gg-auth.module.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-auth/gg-auth.module.ts"],"names":[],"mappings":";;;;;AAAA,yCAA2C;AAC3C,2CAAiE;AACjE,uCAAyC;AACzC,mCAAsC;AACtC,2CAAuC;AACvC,qEAKkC;AAClC,oDAAgD;AAChD,gFAA4E;AAC5E,wEAAoE;AACpE,8EAAwE;AACxE,kFAA4E;AAE5E,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,OAAO,sBAAS,CAAC,eAAe,CAAC;QAC/B,OAAO,EAAE,gCAAc;QACvB,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,gCAAc,EAAE;KACvC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACrC,OAAO,sBAAS,CAAC,eAAe,CAAC;QAC/B,OAAO,EAAE,wCAAkB;QAC3B,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,wCAAkB,EAAE;KAC3C,CAAC,CAAC;AACL,CAAC,CAAC;AAGK,IAAM,YAAY,oBAAlB,MAAM,YAAY;IAChB,MAAM,CAAC,YAAY,CAAC,OAA6B;QACtD,MAAM,cAAc,GAAa;YAC/B,OAAO,EAAE,uDAA8B;YACvC,QAAQ,EAAE,OAAO,EAAE,iBAAiB,IAAI,4CAAmB;SAC5D,CAAC;QAEF,MAAM,gBAAgB,GAAa;YACjC,OAAO,EAAE,yDAAgC;YACzC,QAAQ,EAAE,OAAO,EAAE,mBAAmB,IAAI,gDAAqB;SAChE,CAAC;QAEF,MAAM,SAAS,GAAe;YAC5B,GAAG,CAAC,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC;YAC7B,EAAE,OAAO,EAAE,gBAAS,EAAE,QAAQ,EAAE,sBAAS,EAAE;YAC3C,cAAc;YACd,gBAAgB;YAChB;gBACE,OAAO,EAAE,qDAA4B;gBACrC,UAAU,EAAE,OAAO,EAAE,UAAU;gBAC/B,MAAM,EAAE,OAAO,EAAE,MAAM;aACxB;SACF,CAAC;QAEF,MAAM,OAAO,GAAG,CAAC,qBAAqB,EAAE,EAAE,yBAAyB,EAAE,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;QAEzG,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAA,cAAK,EAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,kBAAU,EAAE,qBAAqB,EAAE,EAAE,yBAAyB,EAAE,CAAC,CAAC;YAC1G,SAAS,EAAE,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;YAC3C,OAAO,EAAE,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,EAAE,yBAAyB,EAAE,CAAC;SAC5F,CAAC;IACJ,CAAC;CACF,CAAA;AAlCY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,YAAY,CAkCxB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { User } from '@zorionapp/gg-toolkit/enum';
|
|
2
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
3
|
+
import { Reflector } from '@nestjs/core';
|
|
4
|
+
import { ClsService } from 'nestjs-cls';
|
|
5
|
+
import { PinoLogger } from 'nestjs-pino';
|
|
6
|
+
import { AuthType } from '../gg-auth.module-options';
|
|
7
|
+
import { AuthorizedMerchant } from '../injectable-proxy/authorized-merchant';
|
|
8
|
+
import { AuthorizedUser } from '../injectable-proxy/authorized-user';
|
|
9
|
+
import { AuthService } from '../services/auth-service.interface';
|
|
10
|
+
type ContextTargets = ReturnType<ExecutionContext['getHandler'] | ExecutionContext['getClass']>[];
|
|
11
|
+
export declare class AuthGuard implements CanActivate {
|
|
12
|
+
private readonly ggAuthMerchantService;
|
|
13
|
+
private readonly ggAuthBearerService;
|
|
14
|
+
private readonly reflector;
|
|
15
|
+
private readonly user;
|
|
16
|
+
private readonly merchant;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
private readonly cls;
|
|
19
|
+
private userStatusExceptionMap;
|
|
20
|
+
constructor(ggAuthMerchantService: AuthService, ggAuthBearerService: AuthService, reflector: Reflector, user: AuthorizedUser, merchant: AuthorizedMerchant, logger: PinoLogger, cls: ClsService);
|
|
21
|
+
/**
|
|
22
|
+
* Check if user is authorized to access endpoint
|
|
23
|
+
*
|
|
24
|
+
* @param context
|
|
25
|
+
*/
|
|
26
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Check user status and throw exception if user is blocked
|
|
29
|
+
*/
|
|
30
|
+
checkUserStatus(allowedUserStatuses?: User.Status[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check merchant allowed IPs and throw exception if it's not allowed
|
|
33
|
+
*/
|
|
34
|
+
checkMerchantIP(): void;
|
|
35
|
+
protected handleRpc(context: ExecutionContext): Promise<boolean>;
|
|
36
|
+
protected handleHttp(context: ExecutionContext): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Try to authorize user by auth type
|
|
39
|
+
*
|
|
40
|
+
* @param authType
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
43
|
+
protected authAttempt(authType: AuthType[]): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Depends on auth type will be used different user query services
|
|
46
|
+
*/
|
|
47
|
+
protected getAuthType(contextTargets: ContextTargets): AuthType[];
|
|
48
|
+
/**
|
|
49
|
+
* Return active roles for currently queried user
|
|
50
|
+
*/
|
|
51
|
+
protected getRoles(contextTargets: ContextTargets): User.Role[];
|
|
52
|
+
/**
|
|
53
|
+
* Return allowed user statuses for currently queried user
|
|
54
|
+
*/
|
|
55
|
+
protected getAllowedUserStatuses(contextTargets: ContextTargets): User.Status[];
|
|
56
|
+
/**
|
|
57
|
+
* Skip authentication if controller hasn't @Protected decorator
|
|
58
|
+
*/
|
|
59
|
+
protected shouldSkipAuth(contextTargets: ContextTargets): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Check UserDTO for having required fields after auth queries
|
|
62
|
+
*/
|
|
63
|
+
protected isAuthenticated(): true;
|
|
64
|
+
/**
|
|
65
|
+
* Set context in logger to track all user's requests
|
|
66
|
+
*/
|
|
67
|
+
protected setLoggerContext(): void;
|
|
68
|
+
}
|
|
69
|
+
export {};
|