chyz 2.0.1-rc.36 → 2.0.1-rc.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseChyz.d.ts +74 -0
- package/dist/BaseChyz.d.ts.map +1 -0
- package/dist/BaseChyz.js +586 -0
- package/dist/base/ActionFilter.d.ts +32 -0
- package/dist/base/ActionFilter.d.ts.map +1 -0
- package/dist/base/ActionFilter.js +90 -0
- package/dist/base/BadRequestHttpException.d.ts +6 -0
- package/dist/base/BadRequestHttpException.d.ts.map +1 -0
- package/dist/base/BadRequestHttpException.js +17 -0
- package/dist/base/BaseError.d.ts +44 -0
- package/dist/base/BaseError.d.ts.map +1 -0
- package/{base/BaseError.ts → dist/base/BaseError.js} +18 -26
- package/dist/base/Behavior.d.ts +4 -0
- package/dist/base/Behavior.d.ts.map +1 -0
- package/dist/base/Behavior.js +7 -0
- package/dist/base/CBaseObject.d.ts +5 -0
- package/dist/base/CBaseObject.d.ts.map +1 -0
- package/dist/base/CBaseObject.js +16 -0
- package/dist/base/CEvents.d.ts +13 -0
- package/dist/base/CEvents.d.ts.map +1 -0
- package/dist/base/CEvents.js +24 -0
- package/dist/base/CRequest.d.ts +2 -0
- package/dist/base/CRequest.d.ts.map +1 -0
- package/{base/CRequest.ts → dist/base/CRequest.js} +2 -6
- package/dist/base/CWebController.d.ts +44 -0
- package/dist/base/CWebController.d.ts.map +1 -0
- package/dist/base/CWebController.js +81 -0
- package/dist/base/Component.d.ts +21 -0
- package/dist/base/Component.d.ts.map +1 -0
- package/dist/base/Component.js +57 -0
- package/dist/base/Configurable.d.ts +3 -0
- package/dist/base/Configurable.d.ts.map +1 -0
- package/{requiments/Glob.ts → dist/base/Configurable.js} +2 -3
- package/dist/base/DataErrorDbException.d.ts +6 -0
- package/dist/base/DataErrorDbException.d.ts.map +1 -0
- package/dist/base/DataErrorDbException.js +17 -0
- package/dist/base/DbConnection.d.ts +13 -0
- package/dist/base/DbConnection.d.ts.map +1 -0
- package/dist/base/DbConnection.js +53 -0
- package/dist/base/ForbiddenHttpException.d.ts +5 -0
- package/dist/base/ForbiddenHttpException.d.ts.map +1 -0
- package/dist/base/ForbiddenHttpException.js +16 -0
- package/dist/base/InvalidArgumentException.d.ts +6 -0
- package/dist/base/InvalidArgumentException.d.ts.map +1 -0
- package/dist/base/InvalidArgumentException.js +17 -0
- package/dist/base/InvalidConfigException.d.ts +6 -0
- package/dist/base/InvalidConfigException.d.ts.map +1 -0
- package/dist/base/InvalidConfigException.js +17 -0
- package/dist/base/Logs.d.ts +22 -0
- package/dist/base/Logs.d.ts.map +1 -0
- package/{base/Logs.ts → dist/base/Logs.js} +24 -41
- package/dist/base/Model.d.ts +302 -0
- package/dist/base/Model.d.ts.map +1 -0
- package/{base/Model.ts → dist/base/Model.js} +158 -225
- package/dist/base/ModelManager.d.ts +2 -0
- package/dist/base/ModelManager.d.ts.map +1 -0
- package/{base/ModelManager.ts → dist/base/ModelManager.js} +7 -7
- package/dist/base/NotFoundHttpException.d.ts +6 -0
- package/dist/base/NotFoundHttpException.d.ts.map +1 -0
- package/dist/base/NotFoundHttpException.js +17 -0
- package/dist/base/RestClient.d.ts +7 -0
- package/dist/base/RestClient.d.ts.map +1 -0
- package/dist/base/RestClient.js +25 -0
- package/dist/base/UnauthorizedHttpException.d.ts +6 -0
- package/dist/base/UnauthorizedHttpException.d.ts.map +1 -0
- package/dist/base/UnauthorizedHttpException.js +17 -0
- package/dist/base/ValidationHttpException.d.ts +6 -0
- package/dist/base/ValidationHttpException.d.ts.map +1 -0
- package/dist/base/ValidationHttpException.js +17 -0
- package/dist/base/db/Exception.d.ts +7 -0
- package/dist/base/db/Exception.d.ts.map +1 -0
- package/dist/base/db/Exception.js +15 -0
- package/dist/base/index.d.ts +20 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +41 -0
- package/dist/decorator/Middleware.d.ts +4 -0
- package/dist/decorator/Middleware.d.ts.map +1 -0
- package/dist/decorator/Middleware.js +10 -0
- package/dist/decorator/controller.d.ts +3 -0
- package/dist/decorator/controller.d.ts.map +1 -0
- package/{decorator/controller.ts → dist/decorator/controller.js} +9 -7
- package/dist/decorator/delete.d.ts +3 -0
- package/dist/decorator/delete.d.ts.map +1 -0
- package/{decorator/delete.ts → dist/decorator/delete.js} +9 -9
- package/dist/decorator/enums/ControllerDecoratorParams.d.ts +6 -0
- package/dist/decorator/enums/ControllerDecoratorParams.d.ts.map +1 -0
- package/dist/decorator/enums/ControllerDecoratorParams.js +9 -0
- package/dist/decorator/get.d.ts +3 -0
- package/dist/decorator/get.d.ts.map +1 -0
- package/{decorator/get.ts → dist/decorator/get.js} +10 -11
- package/dist/decorator/index.d.ts +6 -0
- package/dist/decorator/index.d.ts.map +1 -0
- package/dist/decorator/index.js +13 -0
- package/dist/decorator/post.d.ts +3 -0
- package/dist/decorator/post.d.ts.map +1 -0
- package/{decorator/post.ts → dist/decorator/post.js} +10 -10
- package/dist/decorator/put.d.ts +3 -0
- package/dist/decorator/put.d.ts.map +1 -0
- package/{decorator/put.ts → dist/decorator/put.js} +9 -9
- package/dist/filters/AccessControl.d.ts +12 -0
- package/dist/filters/AccessControl.d.ts.map +1 -0
- package/dist/filters/AccessControl.js +83 -0
- package/dist/filters/AccessRule.d.ts +83 -0
- package/dist/filters/AccessRule.d.ts.map +1 -0
- package/dist/filters/AccessRule.js +136 -0
- package/{filters/auth/AuthInterface.ts → dist/filters/auth/AuthInterface.d.ts} +7 -15
- package/dist/filters/auth/AuthInterface.d.ts.map +1 -0
- package/dist/filters/auth/AuthInterface.js +2 -0
- package/dist/filters/auth/AuthMethod.d.ts +38 -0
- package/dist/filters/auth/AuthMethod.d.ts.map +1 -0
- package/dist/filters/auth/AuthMethod.js +82 -0
- package/dist/filters/auth/HttpBasicAuth.d.ts +24 -0
- package/dist/filters/auth/HttpBasicAuth.d.ts.map +1 -0
- package/dist/filters/auth/HttpBasicAuth.js +79 -0
- package/dist/filters/auth/HttpBearerAuth.d.ts +18 -0
- package/dist/filters/auth/HttpBearerAuth.d.ts.map +1 -0
- package/dist/filters/auth/HttpBearerAuth.js +33 -0
- package/dist/filters/auth/HttpHeaderAuth.d.ts +19 -0
- package/dist/filters/auth/HttpHeaderAuth.d.ts.map +1 -0
- package/dist/filters/auth/HttpHeaderAuth.js +64 -0
- package/dist/filters/auth/JwtHttpBearerAuth.d.ts +21 -0
- package/dist/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -0
- package/dist/filters/auth/JwtHttpBearerAuth.js +88 -0
- package/dist/filters/auth/KeyCloakHttpBearerAuth.d.ts +23 -0
- package/dist/filters/auth/KeyCloakHttpBearerAuth.d.ts.map +1 -0
- package/dist/filters/auth/KeyCloakHttpBearerAuth.js +116 -0
- package/dist/filters/auth/index.d.ts +5 -0
- package/dist/filters/auth/index.d.ts.map +1 -0
- package/dist/filters/auth/index.js +11 -0
- package/dist/filters/index.d.ts +3 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/index.js +7 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/log/log/config/log4js.json +55 -0
- package/dist/model/RouteDefinition.d.ts +7 -0
- package/dist/model/RouteDefinition.d.ts.map +1 -0
- package/{base/Configurable.ts → dist/model/RouteDefinition.js} +2 -4
- package/dist/package.json +63 -0
- package/dist/rbac/AuthAssignment.d.ts +19 -0
- package/dist/rbac/AuthAssignment.d.ts.map +1 -0
- package/dist/rbac/AuthAssignment.js +44 -0
- package/dist/rbac/AuthItem.d.ts +27 -0
- package/dist/rbac/AuthItem.d.ts.map +1 -0
- package/{rbac/AuthItem.ts → dist/rbac/AuthItem.js} +16 -22
- package/dist/rbac/AuthItemChild.d.ts +19 -0
- package/dist/rbac/AuthItemChild.d.ts.map +1 -0
- package/{rbac/AuthItemChild.ts → dist/rbac/AuthItemChild.js} +14 -21
- package/dist/rbac/AuthManager.d.ts +112 -0
- package/dist/rbac/AuthManager.d.ts.map +1 -0
- package/dist/rbac/AuthManager.js +356 -0
- package/dist/rbac/index.d.ts +5 -0
- package/dist/rbac/index.d.ts.map +1 -0
- package/dist/rbac/index.js +28 -0
- package/dist/requiments/Glob.d.ts +3 -0
- package/dist/requiments/Glob.d.ts.map +1 -0
- package/dist/requiments/Glob.js +10 -0
- package/dist/requiments/ReflectUtil.d.ts +1 -0
- package/dist/requiments/ReflectUtil.d.ts.map +1 -0
- package/{requiments/ReflectUtil.ts → dist/requiments/ReflectUtil.js} +4 -6
- package/dist/requiments/Utils.d.ts +2 -0
- package/dist/requiments/Utils.d.ts.map +1 -0
- package/{requiments/Utils.ts → dist/requiments/Utils.js} +34 -40
- package/dist/validators/BooleanValidator.d.ts +1 -0
- package/dist/validators/BooleanValidator.d.ts.map +1 -0
- package/dist/validators/BooleanValidator.js +1 -0
- package/dist/validators/CompareValidator.d.ts +1 -0
- package/dist/validators/CompareValidator.d.ts.map +1 -0
- package/dist/validators/CompareValidator.js +1 -0
- package/dist/validators/DateValidator.d.ts +1 -0
- package/dist/validators/DateValidator.d.ts.map +1 -0
- package/dist/validators/DateValidator.js +1 -0
- package/dist/validators/EmailValidator.d.ts +1 -0
- package/dist/validators/EmailValidator.d.ts.map +1 -0
- package/dist/validators/EmailValidator.js +1 -0
- package/dist/validators/Validator.d.ts +18 -0
- package/dist/validators/Validator.d.ts.map +1 -0
- package/dist/validators/Validator.js +27 -0
- package/{web/IdentityInterface.ts → dist/web/IdentityInterface.d.ts} +2 -15
- package/dist/web/IdentityInterface.d.ts.map +1 -0
- package/dist/web/IdentityInterface.js +8 -0
- package/dist/web/WebUser.d.ts +72 -0
- package/dist/web/WebUser.d.ts.map +1 -0
- package/dist/web/WebUser.js +165 -0
- package/package.json +16 -56
- package/BaseChyz.ts +0 -623
- package/base/ActionFilter.ts +0 -88
- package/base/BadRequestHttpException.ts +0 -14
- package/base/Behavior.ts +0 -6
- package/base/CBaseObject.ts +0 -17
- package/base/CEvents.ts +0 -24
- package/base/CWebController.ts +0 -90
- package/base/Component.ts +0 -66
- package/base/DataErrorDbException.ts +0 -16
- package/base/DbConnection.ts +0 -55
- package/base/ForbiddenHttpException.ts +0 -15
- package/base/InvalidArgumentException.ts +0 -16
- package/base/InvalidConfigException.ts +0 -16
- package/base/NotFoundHttpException.ts +0 -14
- package/base/RestClient.ts +0 -26
- package/base/UnauthorizedHttpException.ts +0 -17
- package/base/ValidationHttpException.ts +0 -14
- package/base/db/Exception.ts +0 -14
- package/base/index.ts +0 -19
- package/decorator/Middleware.ts +0 -9
- package/decorator/enums/ControllerDecoratorParams.ts +0 -5
- package/decorator/index.ts +0 -5
- package/filters/AccessControl.ts +0 -74
- package/filters/AccessRule.ts +0 -182
- package/filters/auth/AuthMethod.ts +0 -100
- package/filters/auth/HttpBasicAuth.ts +0 -79
- package/filters/auth/HttpBearerAuth.ts +0 -34
- package/filters/auth/HttpHeaderAuth.ts +0 -61
- package/filters/auth/JwtHttpBearerAuth.ts +0 -83
- package/filters/auth/KeyCloakHttpBearerAuth.ts +0 -114
- package/filters/auth/index.ts +0 -4
- package/filters/index.ts +0 -2
- package/index.ts +0 -80
- package/model/RouteDefinition.ts +0 -18
- package/rbac/AuthAssignment.ts +0 -50
- package/rbac/AuthManager.ts +0 -399
- package/rbac/index.ts +0 -12
- package/validators/BooleanValidator.ts +0 -0
- package/validators/CompareValidator.ts +0 -0
- package/validators/DateValidator.ts +0 -0
- package/validators/EmailValidator.ts +0 -0
- package/validators/Validator.ts +0 -27
- package/web/WebUser.ts +0 -187
- /package/{README.md → dist/README.md} +0 -0
- /package/{log → dist/log}/config/log4js.json +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HttpBearerAuth } from "./HttpBearerAuth";
|
|
2
|
+
import { Response, Request } from "express";
|
|
3
|
+
import { WebUser } from "../../web/WebUser";
|
|
4
|
+
export declare class JwtHttpBearerAuth extends HttpBearerAuth {
|
|
5
|
+
/**
|
|
6
|
+
* @var string|array<string, mixed>|Jwt application component ID of the JWT handler, configuration array, or JWT handler object
|
|
7
|
+
* itself. By default it's assumes that component of ID "jwt" has been configured.
|
|
8
|
+
*/
|
|
9
|
+
jwt: string;
|
|
10
|
+
auth: any;
|
|
11
|
+
/**
|
|
12
|
+
* @throws InvalidConfigException
|
|
13
|
+
*/
|
|
14
|
+
init(): void;
|
|
15
|
+
authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* @throws UnauthorizedHttpException
|
|
18
|
+
*/
|
|
19
|
+
fail(response: Response): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=JwtHttpBearerAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JwtHttpBearerAuth.d.ts","sourceRoot":"","sources":["../../../src/filters/auth/JwtHttpBearerAuth.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAI1C,qBAAa,iBAAkB,SAAQ,cAAc;IACjD;;;OAGG;IACI,GAAG,SAAQ;IACX,IAAI,EAAE,GAAG,CAAQ;IAGxB;;OAEG;IACI,IAAI,IAAI,IAAI;IAWN,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IAqC7E;;OAEG;IACI,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAKxC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.JwtHttpBearerAuth = void 0;
|
|
16
|
+
/*
|
|
17
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
18
|
+
* Author: Cihan Ozturk
|
|
19
|
+
* E-mail: cihan@chy.com.tr
|
|
20
|
+
* Github:https://github.com/cihan53/
|
|
21
|
+
*/
|
|
22
|
+
const BaseChyz_1 = __importDefault(require("../../BaseChyz"));
|
|
23
|
+
const HttpBearerAuth_1 = require("./HttpBearerAuth");
|
|
24
|
+
const base_1 = require("../../base");
|
|
25
|
+
const JsonWebToken = require("jsonwebtoken");
|
|
26
|
+
class JwtHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* @var string|array<string, mixed>|Jwt application component ID of the JWT handler, configuration array, or JWT handler object
|
|
31
|
+
* itself. By default it's assumes that component of ID "jwt" has been configured.
|
|
32
|
+
*/
|
|
33
|
+
this.jwt = 'jwt';
|
|
34
|
+
this.auth = null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @throws InvalidConfigException
|
|
38
|
+
*/
|
|
39
|
+
init() {
|
|
40
|
+
var _a;
|
|
41
|
+
super.init();
|
|
42
|
+
if (!this.pattern) {
|
|
43
|
+
throw new base_1.InvalidConfigException('You must provide pattern to use to extract the HTTP authentication value!');
|
|
44
|
+
}
|
|
45
|
+
this.user = (_a = BaseChyz_1.default.getComponent("user")) !== null && _a !== void 0 ? _a : null;
|
|
46
|
+
}
|
|
47
|
+
authenticate(user, request, response) {
|
|
48
|
+
var arguments_1 = arguments;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
let autHeader = this.getHeaderByKey(request.headers, this.header);
|
|
51
|
+
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
let identity = null;
|
|
55
|
+
let token = null;
|
|
56
|
+
try {
|
|
57
|
+
token = JsonWebToken.decode(autHeader[1], { complete: true });
|
|
58
|
+
if (!token) {
|
|
59
|
+
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.");
|
|
60
|
+
this.fail(response);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.", autHeader, request.path);
|
|
65
|
+
this.fail(response);
|
|
66
|
+
}
|
|
67
|
+
if (token !== null) {
|
|
68
|
+
if (this.auth != null) {
|
|
69
|
+
identity = yield this.auth(autHeader[1], ...arguments_1);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
identity = yield user.loginByAccessToken(autHeader[1], "JwtHttpBearerAuth");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (identity == null)
|
|
76
|
+
this.fail(response);
|
|
77
|
+
return identity;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @throws UnauthorizedHttpException
|
|
82
|
+
*/
|
|
83
|
+
fail(response) {
|
|
84
|
+
this.challenge(response);
|
|
85
|
+
this.handleFailure(response);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.JwtHttpBearerAuth = JwtHttpBearerAuth;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HttpBearerAuth } from "./HttpBearerAuth";
|
|
2
|
+
import { Request, Response } from "express";
|
|
3
|
+
import { WebUser } from "../../web/WebUser";
|
|
4
|
+
export declare class KeyCloakHttpBearerAuth extends HttpBearerAuth {
|
|
5
|
+
/**
|
|
6
|
+
* @var string|array<string, mixed>|Jwt application component ID of the JWT handler, configuration array, or JWT handler object
|
|
7
|
+
* itself. By default it's assumes that component of ID "jwt" has been configured.
|
|
8
|
+
*/
|
|
9
|
+
jwt: string;
|
|
10
|
+
auth: any;
|
|
11
|
+
keycloak: any;
|
|
12
|
+
/**
|
|
13
|
+
* @throws InvalidConfigException
|
|
14
|
+
*/
|
|
15
|
+
init(): void;
|
|
16
|
+
KeyCloakCheck(token: string, request: Request, response: Response): Promise<any>;
|
|
17
|
+
authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* @throws UnauthorizedHttpException
|
|
20
|
+
*/
|
|
21
|
+
fail(response: Response): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=KeyCloakHttpBearerAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyCloakHttpBearerAuth.d.ts","sourceRoot":"","sources":["../../../src/filters/auth/KeyCloakHttpBearerAuth.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAI1C,qBAAa,sBAAuB,SAAQ,cAAc;IACtD;;;OAGG;IACI,GAAG,SAAQ;IACX,IAAI,EAAE,GAAG,CAAQ;IACjB,QAAQ,EAAE,GAAG,CAAQ;IAG5B;;OAEG;IACI,IAAI,IAAI,IAAI;IAcN,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IAOjE,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IAyD7E;;OAEG;IACI,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAKxC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.KeyCloakHttpBearerAuth = void 0;
|
|
16
|
+
/*
|
|
17
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
18
|
+
* Author: Cihan Ozturk
|
|
19
|
+
* E-mail: cihan@chy.com.tr
|
|
20
|
+
* Github:https://github.com/cihan53/
|
|
21
|
+
*/
|
|
22
|
+
const BaseChyz_1 = __importDefault(require("../../BaseChyz"));
|
|
23
|
+
const HttpBearerAuth_1 = require("./HttpBearerAuth");
|
|
24
|
+
const InvalidConfigException_1 = require("../../base/InvalidConfigException");
|
|
25
|
+
const JsonWebToken = require("jsonwebtoken");
|
|
26
|
+
class KeyCloakHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* @var string|array<string, mixed>|Jwt application component ID of the JWT handler, configuration array, or JWT handler object
|
|
31
|
+
* itself. By default it's assumes that component of ID "jwt" has been configured.
|
|
32
|
+
*/
|
|
33
|
+
this.jwt = 'jwt';
|
|
34
|
+
this.auth = null;
|
|
35
|
+
this.keycloak = null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @throws InvalidConfigException
|
|
39
|
+
*/
|
|
40
|
+
init() {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
super.init();
|
|
43
|
+
if (!this.pattern) {
|
|
44
|
+
throw new InvalidConfigException_1.InvalidConfigException('You must provide pattern to use to extract the HTTP authentication value!');
|
|
45
|
+
}
|
|
46
|
+
this.keycloak = (_a = BaseChyz_1.default.getMiddlewares("keycloak").keycloak) !== null && _a !== void 0 ? _a : null;
|
|
47
|
+
this.user = (_b = BaseChyz_1.default.getComponent("user")) !== null && _b !== void 0 ? _b : null;
|
|
48
|
+
this.auth = this.KeyCloakCheck;
|
|
49
|
+
}
|
|
50
|
+
KeyCloakCheck(token, request, response) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
if (this.keycloak == null)
|
|
53
|
+
return false;
|
|
54
|
+
// return await this.keycloak.protect('realm:user')(request, response, () => true /*next*/)
|
|
55
|
+
return yield this.keycloak.protect()(request, response, () => true /*next*/);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
authenticate(user, request, response) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
let identity = null;
|
|
61
|
+
let token = null;
|
|
62
|
+
let autHeader = this.getHeaderByKey(request.headers, this.header);
|
|
63
|
+
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
64
|
+
return this.fail(response);
|
|
65
|
+
}
|
|
66
|
+
token = JsonWebToken.decode(autHeader[1], { complete: true });
|
|
67
|
+
if (!token) {
|
|
68
|
+
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.");
|
|
69
|
+
this.fail(response);
|
|
70
|
+
}
|
|
71
|
+
if (token !== null) {
|
|
72
|
+
identity = yield this.KeyCloakCheck(autHeader[1], request, response);
|
|
73
|
+
BaseChyz_1.default.debug("KeyCloakCheck Result:", identity);
|
|
74
|
+
}
|
|
75
|
+
if (identity == null || identity == false)
|
|
76
|
+
this.fail(response);
|
|
77
|
+
return identity;
|
|
78
|
+
/* let autHeader = this.getHeaderByKey(request.headers, this.header)
|
|
79
|
+
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
BaseChyz.debug("JSON Web Token.",autHeader);
|
|
84
|
+
let identity = null;
|
|
85
|
+
let token = null;
|
|
86
|
+
|
|
87
|
+
token = JsonWebToken.decode(autHeader[1], {complete: true})
|
|
88
|
+
if (!token) {
|
|
89
|
+
BaseChyz.warning("Your request was made with invalid or expired JSON Web Token.");
|
|
90
|
+
this.fail(response);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (token !== null) {
|
|
94
|
+
if (this.auth != null) {
|
|
95
|
+
identity = await this.auth(autHeader[1])
|
|
96
|
+
} else {
|
|
97
|
+
identity = await user.loginByAccessToken(autHeader[1], "JwtHttpBearerAuth")
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (identity == null) this.fail(response)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
return identity;*/
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @throws UnauthorizedHttpException
|
|
110
|
+
*/
|
|
111
|
+
fail(response) {
|
|
112
|
+
// this.challenge(response)
|
|
113
|
+
this.handleFailure(response);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.KeyCloakHttpBearerAuth = KeyCloakHttpBearerAuth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/filters/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpBasicAuth = exports.HttpHeaderAuth = exports.HttpBearerAuth = exports.JwtHttpBearerAuth = void 0;
|
|
4
|
+
var JwtHttpBearerAuth_1 = require("./JwtHttpBearerAuth");
|
|
5
|
+
Object.defineProperty(exports, "JwtHttpBearerAuth", { enumerable: true, get: function () { return JwtHttpBearerAuth_1.JwtHttpBearerAuth; } });
|
|
6
|
+
var HttpBearerAuth_1 = require("./HttpBearerAuth");
|
|
7
|
+
Object.defineProperty(exports, "HttpBearerAuth", { enumerable: true, get: function () { return HttpBearerAuth_1.HttpBearerAuth; } });
|
|
8
|
+
var HttpHeaderAuth_1 = require("./HttpHeaderAuth");
|
|
9
|
+
Object.defineProperty(exports, "HttpHeaderAuth", { enumerable: true, get: function () { return HttpHeaderAuth_1.HttpHeaderAuth; } });
|
|
10
|
+
var HttpBasicAuth_1 = require("./HttpBasicAuth");
|
|
11
|
+
Object.defineProperty(exports, "HttpBasicAuth", { enumerable: true, get: function () { return HttpBasicAuth_1.HttpBasicAuth; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccessRule = exports.AccessControl = void 0;
|
|
4
|
+
var AccessControl_1 = require("./AccessControl");
|
|
5
|
+
Object.defineProperty(exports, "AccessControl", { enumerable: true, get: function () { return AccessControl_1.AccessControl; } });
|
|
6
|
+
var AccessRule_1 = require("./AccessRule");
|
|
7
|
+
Object.defineProperty(exports, "AccessRule", { enumerable: true, get: function () { return AccessRule_1.AccessRule; } });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface String {
|
|
3
|
+
tokenReplace(obj: any): string;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
import BaseChyz from "./BaseChyz";
|
|
7
|
+
import { RestClient } from "./base";
|
|
8
|
+
declare module "express-serve-static-core" {
|
|
9
|
+
interface Request {
|
|
10
|
+
identity: any;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const Chyz_Version: any;
|
|
14
|
+
declare const Chyz: BaseChyz;
|
|
15
|
+
export { Request, Response, NextFunction } from "./base/CRequest";
|
|
16
|
+
export { RouteDefinition } from "./model/RouteDefinition";
|
|
17
|
+
export { WebUser } from "./web/WebUser";
|
|
18
|
+
export { BaseChyz, RestClient };
|
|
19
|
+
export { Logs, ActionFilter, BaseError, Behavior, Component, Configurable, CWebController, DbConnection, ForbiddenHttpException, InvalidConfigException, InvalidArgumentException, NotFoundHttpException, UnauthorizedHttpException, DataErrorDbException, ValidationHttpException, Model, ModelManager, CEvents } from "./base";
|
|
20
|
+
export * from "./filters";
|
|
21
|
+
export * from "./filters/auth";
|
|
22
|
+
export * from "./rbac/";
|
|
23
|
+
export * from "./decorator";
|
|
24
|
+
export * from "./requiments/Utils";
|
|
25
|
+
export default Chyz;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;KAClC;CACJ;AAQD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAGlC,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;AAkBD,eAAO,MAAM,YAAY,KAAgB,CAAC;AAG1C,QAAA,MAAM,IAAI,UAAiB,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAA;AAC7B,OAAO,EACH,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,OAAO,EACV,MAAM,QAAQ,CAAC;AAChB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AAExB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AAEnC,eAAe,IAAI,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022.. Chy Bilgisayar Bilisim
|
|
5
|
+
* Author: Cihan Ozturk
|
|
6
|
+
* E-mail: cihan@chy.com.tr
|
|
7
|
+
* Github:https://github.com/cihan53/
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.CEvents = exports.ModelManager = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.BaseError = exports.ActionFilter = exports.Logs = exports.RestClient = exports.BaseChyz = exports.WebUser = exports.Chyz_Version = void 0;
|
|
29
|
+
const BaseChyz_1 = __importDefault(require("./BaseChyz"));
|
|
30
|
+
exports.BaseChyz = BaseChyz_1.default;
|
|
31
|
+
const base_1 = require("./base");
|
|
32
|
+
Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return base_1.RestClient; } });
|
|
33
|
+
String.prototype.tokenReplace = function (obj) {
|
|
34
|
+
let retStr = this;
|
|
35
|
+
for (let x in obj) {
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
retStr = retStr.replace(new RegExp("\\:" + x, 'g'), obj[x]).toString();
|
|
38
|
+
}
|
|
39
|
+
return retStr;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
const pjson = require('./package.json');
|
|
45
|
+
exports.Chyz_Version = pjson.version;
|
|
46
|
+
console.log(`BaseChyz Framework Version ${exports.Chyz_Version}`);
|
|
47
|
+
const Chyz = new BaseChyz_1.default();
|
|
48
|
+
var WebUser_1 = require("./web/WebUser");
|
|
49
|
+
Object.defineProperty(exports, "WebUser", { enumerable: true, get: function () { return WebUser_1.WebUser; } });
|
|
50
|
+
var base_2 = require("./base");
|
|
51
|
+
Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return base_2.Logs; } });
|
|
52
|
+
Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return base_2.ActionFilter; } });
|
|
53
|
+
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_2.BaseError; } });
|
|
54
|
+
Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return base_2.Behavior; } });
|
|
55
|
+
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return base_2.Component; } });
|
|
56
|
+
Object.defineProperty(exports, "CWebController", { enumerable: true, get: function () { return base_2.CWebController; } });
|
|
57
|
+
Object.defineProperty(exports, "DbConnection", { enumerable: true, get: function () { return base_2.DbConnection; } });
|
|
58
|
+
Object.defineProperty(exports, "ForbiddenHttpException", { enumerable: true, get: function () { return base_2.ForbiddenHttpException; } });
|
|
59
|
+
Object.defineProperty(exports, "InvalidConfigException", { enumerable: true, get: function () { return base_2.InvalidConfigException; } });
|
|
60
|
+
Object.defineProperty(exports, "InvalidArgumentException", { enumerable: true, get: function () { return base_2.InvalidArgumentException; } });
|
|
61
|
+
Object.defineProperty(exports, "NotFoundHttpException", { enumerable: true, get: function () { return base_2.NotFoundHttpException; } });
|
|
62
|
+
Object.defineProperty(exports, "UnauthorizedHttpException", { enumerable: true, get: function () { return base_2.UnauthorizedHttpException; } });
|
|
63
|
+
Object.defineProperty(exports, "DataErrorDbException", { enumerable: true, get: function () { return base_2.DataErrorDbException; } });
|
|
64
|
+
Object.defineProperty(exports, "ValidationHttpException", { enumerable: true, get: function () { return base_2.ValidationHttpException; } });
|
|
65
|
+
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return base_2.Model; } });
|
|
66
|
+
Object.defineProperty(exports, "ModelManager", { enumerable: true, get: function () { return base_2.ModelManager; } });
|
|
67
|
+
Object.defineProperty(exports, "CEvents", { enumerable: true, get: function () { return base_2.CEvents; } });
|
|
68
|
+
__exportStar(require("./filters"), exports);
|
|
69
|
+
__exportStar(require("./filters/auth"), exports);
|
|
70
|
+
__exportStar(require("./rbac/"), exports);
|
|
71
|
+
__exportStar(require("./decorator"), exports);
|
|
72
|
+
__exportStar(require("./requiments/Utils"), exports);
|
|
73
|
+
exports.default = Chyz;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"appenders": {
|
|
3
|
+
"access": {
|
|
4
|
+
"type": "dateFile",
|
|
5
|
+
"filename": "log/access.log",
|
|
6
|
+
"pattern": "-yyyy-MM-dd",
|
|
7
|
+
"category": "http",
|
|
8
|
+
"layout": {
|
|
9
|
+
"type": "pattern",
|
|
10
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"app": {
|
|
14
|
+
"type": "file",
|
|
15
|
+
"filename": "log/app.log",
|
|
16
|
+
"maxLogSize": 10485760,
|
|
17
|
+
"numBackups": 3,
|
|
18
|
+
"layout": {
|
|
19
|
+
"type": "pattern",
|
|
20
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"errorFile": {
|
|
24
|
+
"type": "file",
|
|
25
|
+
"filename": "log/errors.log",
|
|
26
|
+
"layout": {
|
|
27
|
+
"type": "pattern",
|
|
28
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"errors": {
|
|
32
|
+
"type": "logLevelFilter",
|
|
33
|
+
"level": "ERROR",
|
|
34
|
+
"appender": "errorFile",
|
|
35
|
+
"layout": {
|
|
36
|
+
"type": "pattern",
|
|
37
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"console": {
|
|
41
|
+
"type": "stdout"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"categories": {
|
|
45
|
+
"default": {
|
|
46
|
+
"appenders": ["console","app" ,"errors" ],
|
|
47
|
+
"level": "INFO",
|
|
48
|
+
"enableCallStack": true
|
|
49
|
+
},
|
|
50
|
+
"http": {
|
|
51
|
+
"level": "INFO",
|
|
52
|
+
"appenders": [ "access" ]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteDefinition.d.ts","sourceRoot":"","sources":["../../src/model/RouteDefinition.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAE5B,EAAE,EAAC,MAAM,CAAC;IAEV,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC;IAE7D,UAAU,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*
|
|
2
3
|
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
4
|
* Author: Cihan Ozturk
|
|
4
5
|
* E-mail: cihan@chy.com.tr
|
|
5
6
|
* Github:https://github.com/cihan53/
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
export interface Configurable{
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chyz",
|
|
3
|
+
"version": "2.0.1-rc.36",
|
|
4
|
+
"description": "Nodejs Micro service Framework",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"postversion": "git push && git push --tags"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/cihan53/Chy-Nodejs-Framework.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "Cihan Ozturk",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/cihan53/Chy-Nodejs-Framework/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@types/compression": "^1.7.5",
|
|
21
|
+
"axios": "^1.3.5",
|
|
22
|
+
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
23
|
+
"body-parser": "^1.20.2",
|
|
24
|
+
"compression": "^1.7.4",
|
|
25
|
+
"core-js": "^3.30.1",
|
|
26
|
+
"cors": "^2.8.5",
|
|
27
|
+
"dayjs": "^1.11.7",
|
|
28
|
+
"dotenv-flow": "^3.2.0",
|
|
29
|
+
"express": "^4.18.2",
|
|
30
|
+
"express-session": "^1.17.3",
|
|
31
|
+
"glob": "^10.0.0",
|
|
32
|
+
"ip": "^1.1.8",
|
|
33
|
+
"jsonwebtoken": "^9.0.0",
|
|
34
|
+
"lodash": "^4.17.21",
|
|
35
|
+
"lodash-uuid": "^0.0.3",
|
|
36
|
+
"log4js": "^6.9.1",
|
|
37
|
+
"method-override": "^3.0.0",
|
|
38
|
+
"passport": "^0.6.0",
|
|
39
|
+
"pg": "^8.10.0",
|
|
40
|
+
"pg-hstore": "^2.3.4",
|
|
41
|
+
"reflect-metadata": "^0.1.13",
|
|
42
|
+
"sequelize": "^6.31.0",
|
|
43
|
+
"sequelize-transparent-cache": "^2.3.0",
|
|
44
|
+
"tslib": "^2.5.0",
|
|
45
|
+
"validate.js": "^0.13.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/express": "^4.17.17",
|
|
49
|
+
"@types/node": "^18.15.11",
|
|
50
|
+
"@types/validator": "^13.7.15",
|
|
51
|
+
"nodemon": "^2.0.22",
|
|
52
|
+
"ts-node": "^10.9.1",
|
|
53
|
+
"typescript": "^5.0.4"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"Framework",
|
|
57
|
+
"RespAPI",
|
|
58
|
+
"microservice",
|
|
59
|
+
"micro service",
|
|
60
|
+
"easy configuration",
|
|
61
|
+
"Rbac support"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataTypes, Model, Relation } from "../base";
|
|
2
|
+
export declare class AuthAssignmentClass extends Model {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
tableName(): string;
|
|
5
|
+
attributes(): {
|
|
6
|
+
item_name: {
|
|
7
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
8
|
+
primaryKey: boolean;
|
|
9
|
+
allowNull: boolean;
|
|
10
|
+
};
|
|
11
|
+
user_id: {
|
|
12
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
13
|
+
allowNull: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
init(): void;
|
|
17
|
+
relations(): Relation[];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=AuthAssignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthAssignment.d.ts","sourceRoot":"","sources":["../../src/rbac/AuthAssignment.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAgB,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjE,qBAAa,mBAAoB,SAAQ,KAAK;IAC1C,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEjB,SAAS;IAGT,UAAU;;;;;;;;;;;IAiBV,IAAI;IAKJ,SAAS,IAAI,QAAQ,EAAE;CAW1B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
+
* Author: Cihan Ozturk
|
|
5
|
+
* E-mail: cihan@chy.com.tr
|
|
6
|
+
* Github:https://github.com/cihan53/
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthAssignmentClass = void 0;
|
|
10
|
+
const base_1 = require("../base");
|
|
11
|
+
class AuthAssignmentClass extends base_1.Model {
|
|
12
|
+
tableName() {
|
|
13
|
+
return 'auth_assignment';
|
|
14
|
+
}
|
|
15
|
+
attributes() {
|
|
16
|
+
return {
|
|
17
|
+
// Model attributes are defined here
|
|
18
|
+
item_name: {
|
|
19
|
+
type: base_1.DataTypes.STRING,
|
|
20
|
+
primaryKey: true,
|
|
21
|
+
allowNull: false
|
|
22
|
+
},
|
|
23
|
+
user_id: {
|
|
24
|
+
type: base_1.DataTypes.STRING,
|
|
25
|
+
allowNull: false
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
init() {
|
|
30
|
+
super.init();
|
|
31
|
+
this.model().removeAttribute('id');
|
|
32
|
+
}
|
|
33
|
+
relations() {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
type: "hasMany",
|
|
37
|
+
foreignKey: "name",
|
|
38
|
+
sourceKey: 'item_name',
|
|
39
|
+
model: base_1.ModelManager.AuthItem.model()
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AuthAssignmentClass = AuthAssignmentClass;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DataTypes, Model, Relation } from "../base";
|
|
2
|
+
export declare class AuthItemClass extends Model {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
tableName(): string;
|
|
5
|
+
attributes(): {
|
|
6
|
+
name: {
|
|
7
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
8
|
+
primaryKey: boolean;
|
|
9
|
+
allowNull: boolean;
|
|
10
|
+
};
|
|
11
|
+
type: {
|
|
12
|
+
type: DataTypes.IntegerDataTypeConstructor;
|
|
13
|
+
allowNull: boolean;
|
|
14
|
+
};
|
|
15
|
+
description: {
|
|
16
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
17
|
+
allowNull: boolean;
|
|
18
|
+
};
|
|
19
|
+
rule_name: {
|
|
20
|
+
type: DataTypes.StringDataTypeConstructor;
|
|
21
|
+
allowNull: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
init(): void;
|
|
25
|
+
relations(): Relation[];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=AuthItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthItem.d.ts","sourceRoot":"","sources":["../../src/rbac/AuthItem.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAgB,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjE,qBAAa,aAAc,SAAQ,KAAK;IACpC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEjB,SAAS;IAIT,UAAU;;;;;;;;;;;;;;;;;;;IAwBV,IAAI;IAKJ,SAAS,IAAI,QAAQ,EAAE;CAU1B"}
|