chyz 1.2.1-rc.0 → 1.2.4-rc.1
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/BaseChyz.ts +454 -0
- package/Chyz.ts +11 -0
- package/Doc/Git.md +29 -0
- package/Doc/Moel kullanma.md +13 -0
- package/Examples/Controllers/ApiController.ts +110 -0
- package/Examples/Models/User.ts +122 -0
- package/Examples/index-keycloack.ts +78 -0
- package/Examples/index.ts +60 -0
- package/Examples/keycloak.json +7 -0
- package/Examples/package.json +49 -0
- package/Examples/tsconfig.json +21 -0
- package/README.md +518 -0
- package/base/ActionFilter.ts +71 -0
- package/base/BaseError.ts +28 -0
- package/base/BaseObject.ts +19 -0
- package/base/Behavior.ts +6 -0
- package/base/CWebController.ts +84 -0
- package/base/Component.ts +66 -0
- package/base/Configurable.ts +10 -0
- package/base/DataErrorDbException.ts +16 -0
- package/base/DbConnection.ts +55 -0
- package/base/ForbiddenHttpException.ts +15 -0
- package/base/InvalidArgumentException.ts +16 -0
- package/base/InvalidConfigException.ts +16 -0
- package/base/Model.ts +555 -0
- package/base/ModelManager.ts +19 -0
- package/base/NotFoundHttpException.ts +14 -0
- package/base/RestClient.ts +28 -0
- package/base/UnauthorizedHttpException.ts +17 -0
- package/base/ValidationHttpException.ts +14 -0
- package/base/db/Exception.ts +14 -0
- package/base/index.ts +18 -0
- package/decorator/Middleware.ts +9 -0
- package/decorator/controller.ts +22 -0
- package/decorator/enums/ControllerDecoratorParams.ts +5 -0
- package/decorator/get.ts +37 -0
- package/decorator/index.ts +3 -0
- package/decorator/post.ts +36 -0
- package/{BaseChyz.js → dist/BaseChyz.js} +0 -0
- package/{BaseChyz.js.map → dist/BaseChyz.js.map} +0 -0
- package/{Chyz.js → dist/Chyz.js} +0 -0
- package/{Chyz.js.map → dist/Chyz.js.map} +0 -0
- package/{base → dist/base}/ActionFilter.js +0 -0
- package/{base → dist/base}/ActionFilter.js.map +0 -0
- package/{base → dist/base}/BaseError.js +0 -0
- package/{base → dist/base}/BaseError.js.map +0 -0
- package/{base → dist/base}/BaseObject.js +0 -0
- package/{base → dist/base}/BaseObject.js.map +0 -0
- package/{base → dist/base}/Behavior.js +0 -0
- package/{base → dist/base}/Behavior.js.map +0 -0
- package/{base → dist/base}/CWebController.js +0 -0
- package/{base → dist/base}/CWebController.js.map +0 -0
- package/{base → dist/base}/Component.js +0 -0
- package/{base → dist/base}/Component.js.map +0 -0
- package/{base → dist/base}/Configurable.js +0 -0
- package/{base → dist/base}/Configurable.js.map +0 -0
- package/{base → dist/base}/DataErrorDbException.js +0 -0
- package/{base → dist/base}/DataErrorDbException.js.map +0 -0
- package/{base → dist/base}/DbConnection.js +0 -0
- package/{base → dist/base}/DbConnection.js.map +0 -0
- package/{base → dist/base}/ForbiddenHttpException.js +0 -0
- package/{base → dist/base}/ForbiddenHttpException.js.map +0 -0
- package/{base → dist/base}/InvalidArgumentException.js +0 -0
- package/{base → dist/base}/InvalidArgumentException.js.map +0 -0
- package/{base → dist/base}/InvalidConfigException.js +0 -0
- package/{base → dist/base}/InvalidConfigException.js.map +0 -0
- package/{base → dist/base}/Model.js +0 -0
- package/{base → dist/base}/Model.js.map +0 -0
- package/{base → dist/base}/ModelManager.js +0 -0
- package/{base → dist/base}/ModelManager.js.map +0 -0
- package/{base → dist/base}/NotFoundHttpException.js +0 -0
- package/{base → dist/base}/NotFoundHttpException.js.map +0 -0
- package/{base → dist/base}/RestClient.js +0 -0
- package/{base → dist/base}/RestClient.js.map +0 -0
- package/{base → dist/base}/UnauthorizedHttpException.js +0 -0
- package/{base → dist/base}/UnauthorizedHttpException.js.map +0 -0
- package/{base → dist/base}/ValidationHttpException.js +0 -0
- package/{base → dist/base}/ValidationHttpException.js.map +0 -0
- package/{base → dist/base}/db/Exception.js +0 -0
- package/{base → dist/base}/db/Exception.js.map +0 -0
- package/{base → dist/base}/index.js +0 -0
- package/{base → dist/base}/index.js.map +0 -0
- package/{decorator → dist/decorator}/Middleware.js +0 -0
- package/{decorator → dist/decorator}/Middleware.js.map +0 -0
- package/{decorator → dist/decorator}/controller.js +0 -0
- package/{decorator → dist/decorator}/controller.js.map +0 -0
- package/{decorator → dist/decorator}/enums/ControllerDecoratorParams.js +0 -0
- package/{decorator → dist/decorator}/enums/ControllerDecoratorParams.js.map +0 -0
- package/{decorator → dist/decorator}/get.js +0 -0
- package/{decorator → dist/decorator}/get.js.map +0 -0
- package/{decorator → dist/decorator}/index.js +0 -0
- package/{decorator → dist/decorator}/index.js.map +0 -0
- package/{decorator → dist/decorator}/post.js +0 -0
- package/{decorator → dist/decorator}/post.js.map +0 -0
- package/{filters → dist/filters}/AccessControl.js +0 -1
- package/dist/filters/AccessControl.js.map +1 -0
- package/{filters → dist/filters}/AccessRule.js +0 -0
- package/{filters → dist/filters}/AccessRule.js.map +0 -0
- package/{filters → dist/filters}/auth/AuthInterface.js +0 -0
- package/{filters → dist/filters}/auth/AuthInterface.js.map +0 -0
- package/{filters → dist/filters}/auth/AuthMethod.js +0 -0
- package/{filters → dist/filters}/auth/AuthMethod.js.map +1 -1
- package/{filters → dist/filters}/auth/HttpBasicAuth.js +0 -0
- package/{filters → dist/filters}/auth/HttpBasicAuth.js.map +0 -0
- package/{filters → dist/filters}/auth/HttpBearerAuth.js +0 -0
- package/{filters → dist/filters}/auth/HttpBearerAuth.js.map +0 -0
- package/{filters → dist/filters}/auth/HttpHeaderAuth.js +0 -0
- package/{filters → dist/filters}/auth/HttpHeaderAuth.js.map +0 -0
- package/{filters → dist/filters}/auth/JwtHttpBearerAuth.js +2 -3
- package/{filters → dist/filters}/auth/JwtHttpBearerAuth.js.map +1 -1
- package/{filters → dist/filters}/auth/KeyCloakHttpBearerAuth.js +0 -0
- package/{filters → dist/filters}/auth/KeyCloakHttpBearerAuth.js.map +0 -0
- package/{filters → dist/filters}/auth/index.js +0 -0
- package/{filters → dist/filters}/auth/index.js.map +0 -0
- package/{filters → dist/filters}/index.js +0 -0
- package/{filters → dist/filters}/index.js.map +0 -0
- package/{index.js → dist/index.js} +0 -0
- package/{index.js.map → dist/index.js.map} +0 -0
- package/dist/log/config/log4js.json +55 -0
- package/{model → dist/model}/RouteDefinition.js +0 -0
- package/{model → dist/model}/RouteDefinition.js.map +0 -0
- package/dist/package.json +59 -0
- package/{rbac → dist/rbac}/AuthAssignment.js +0 -0
- package/{rbac → dist/rbac}/AuthAssignment.js.map +0 -0
- package/{rbac → dist/rbac}/AuthItem.js +0 -0
- package/{rbac → dist/rbac}/AuthItem.js.map +0 -0
- package/{rbac → dist/rbac}/AuthItemChild.js +0 -0
- package/{rbac → dist/rbac}/AuthItemChild.js.map +0 -0
- package/{rbac → dist/rbac}/AuthManager.js +0 -0
- package/{rbac → dist/rbac}/AuthManager.js.map +0 -0
- package/{requiments → dist/requiments}/Glob.js +0 -0
- package/{requiments → dist/requiments}/Glob.js.map +0 -0
- package/{requiments → dist/requiments}/ReflectUtil.js +0 -0
- package/{requiments → dist/requiments}/ReflectUtil.js.map +0 -0
- package/{requiments → dist/requiments}/Utils.js +0 -0
- package/{requiments → dist/requiments}/Utils.js.map +0 -0
- package/{validators → dist/validators}/BooleanValidator.js +0 -0
- package/{validators → dist/validators}/BooleanValidator.js.map +0 -0
- package/{validators → dist/validators}/CompareValidator.js +0 -0
- package/{validators → dist/validators}/CompareValidator.js.map +0 -0
- package/{validators → dist/validators}/DateValidator.js +0 -0
- package/{validators → dist/validators}/DateValidator.js.map +0 -0
- package/{validators → dist/validators}/EmailValidator.js +0 -0
- package/{validators → dist/validators}/EmailValidator.js.map +0 -0
- package/{validators → dist/validators}/Validator.js +0 -0
- package/{validators → dist/validators}/Validator.js.map +0 -0
- package/{web → dist/web}/IdentityInterface.js +0 -0
- package/{web → dist/web}/IdentityInterface.js.map +0 -0
- package/{web → dist/web}/WebUser.js +0 -0
- package/{web → dist/web}/WebUser.js.map +0 -0
- package/filters/AccessControl.ts +74 -0
- package/filters/AccessRule.ts +182 -0
- package/filters/auth/AuthInterface.ts +34 -0
- package/filters/auth/AuthMethod.ts +89 -0
- package/filters/auth/HttpBasicAuth.ts +75 -0
- package/filters/auth/HttpBearerAuth.ts +31 -0
- package/filters/auth/HttpHeaderAuth.ts +53 -0
- package/filters/auth/JwtHttpBearerAuth.ts +80 -0
- package/filters/auth/KeyCloakHttpBearerAuth.ts +115 -0
- package/filters/auth/index.ts +4 -0
- package/filters/index.ts +2 -0
- package/index.ts +16 -0
- package/log/config/log4js.json +1 -1
- package/model/RouteDefinition.ts +18 -0
- package/package-lock.json +5259 -0
- package/package.json +2 -2
- package/rbac/AuthAssignment.ts +50 -0
- package/rbac/AuthItem.ts +57 -0
- package/rbac/AuthItemChild.ts +50 -0
- package/rbac/AuthManager.ts +398 -0
- package/requiments/Glob.ts +9 -0
- package/requiments/ReflectUtil.ts +26 -0
- package/requiments/Utils.ts +63 -0
- package/tsconfig.json +18 -0
- 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 +27 -0
- package/web/IdentityInterface.ts +68 -0
- package/web/WebUser.ts +187 -0
- package/filters/AccessControl.js.map +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
+
* Author: Cihan Ozturk
|
|
4
|
+
* E-mail: cihan@chy.com.tr
|
|
5
|
+
* Github:https://github.com/cihan53/
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import "reflect-metadata";
|
|
10
|
+
export const controller = (prefix: string = ''): ClassDecorator => {
|
|
11
|
+
return (target: any) => {
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
Reflect.defineMetadata('prefix', prefix, target);
|
|
14
|
+
|
|
15
|
+
// Since routes are set by our methods this should almost never be true (except the controller has no methods)
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
if (! Reflect.hasMetadata('routes', target)) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
Reflect.defineMetadata('routes', [], target);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
package/decorator/get.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
+
* Author: Cihan Ozturk
|
|
4
|
+
* E-mail: cihan@chy.com.tr
|
|
5
|
+
* Github:https://github.com/cihan53/
|
|
6
|
+
*/
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import "reflect-metadata";
|
|
9
|
+
import {RouteDefinition} from '../model/RouteDefinition';
|
|
10
|
+
|
|
11
|
+
export const get = (path: string): MethodDecorator => {
|
|
12
|
+
// `target` equals our class, `propertyKey` equals our decorated method name
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
return (target, propertyKey: string): void => {
|
|
15
|
+
// In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
|
|
16
|
+
// To prevent any further validation simply set it to an empty array here.
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
if (!Reflect.hasMetadata('routes', target.constructor)) {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
Reflect.defineMetadata('routes', [], target.constructor);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Get the routes stored so far, extend it by the new route and re-set the metadata.
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
|
|
26
|
+
|
|
27
|
+
routes.push({
|
|
28
|
+
id:"",
|
|
29
|
+
requestMethod: 'get',
|
|
30
|
+
path,
|
|
31
|
+
methodName: propertyKey
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
Reflect.defineMetadata('routes', routes, target.constructor);
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
+
* Author: Cihan Ozturk
|
|
4
|
+
* E-mail: cihan@chy.com.tr
|
|
5
|
+
* Github:https://github.com/cihan53/
|
|
6
|
+
*/
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import "reflect-metadata";
|
|
9
|
+
import {RouteDefinition} from '../model/RouteDefinition';
|
|
10
|
+
|
|
11
|
+
export const post = (path: string): MethodDecorator => {
|
|
12
|
+
// `target` equals our class, `propertyKey` equals our decorated method name
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
return (target, propertyKey: string): void => {
|
|
15
|
+
// In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
|
|
16
|
+
// To prevent any further validation simply set it to an empty array here.
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
if (!Reflect.hasMetadata('routes', target.constructor)) {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
Reflect.defineMetadata('routes', [], target.constructor);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Get the routes stored so far, extend it by the new route and re-set the metadata.
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
|
|
26
|
+
|
|
27
|
+
routes.push({
|
|
28
|
+
id:"",
|
|
29
|
+
requestMethod: 'post',
|
|
30
|
+
path,
|
|
31
|
+
methodName: propertyKey
|
|
32
|
+
});
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
Reflect.defineMetadata('routes', routes, target.constructor);
|
|
35
|
+
};
|
|
36
|
+
};
|
|
File without changes
|
|
File without changes
|
package/{Chyz.js → dist/Chyz.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,7 +25,6 @@ const ActionFilter_1 = require("../base/ActionFilter");
|
|
|
25
25
|
const AccessRule_1 = require("./AccessRule");
|
|
26
26
|
const WebUser_1 = require("../web/WebUser");
|
|
27
27
|
const Utils_1 = __importDefault(require("../requiments/Utils"));
|
|
28
|
-
var _ = require('lodash');
|
|
29
28
|
class AccessControl extends ActionFilter_1.ActionFilter {
|
|
30
29
|
constructor() {
|
|
31
30
|
super(...arguments);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessControl.js","sourceRoot":"","sources":["../../filters/AccessControl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,2DAAmC;AACnC,2EAAsE;AACtE,uDAAkD;AAClD,6CAAwC;AACxC,4CAAuC;AACvC,gEAAwC;AAGxC,MAAa,aAAc,SAAQ,2BAAY;IAA/C;;QAEW,SAAI,GAAQ,IAAI,CAAC;QAEjB,iBAAY,GAAQ,IAAI,CAAC;IAuDpC,CAAC;IArDU,IAAI;;QACP,KAAK,CAAC,IAAI,EAAE,CAAA;QAEZ,IAAI,IAAI,CAAC,IAAI,IAAI,SAAS,EAAE;YACxB,IAAI,CAAC,IAAI,GAAG,MAAA,eAAK,CAAC,SAAS,CAAC,kBAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,mCAAI,IAAI,iBAAO,EAAE,CAAC;SAC/E;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AI,CAAC,CAAC;aACzB;YAED,OAAO,KAAK,CAAC;;KAChB;IAEM,UAAU,CAAC,IAAa;QAC3B,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACxC,IAAI,CAAC,aAAa,EAAE,CAAC;SACxB;;YAAM,MAAM,IAAI,+CAAsB,CAAC,kBAAQ,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC;IACvG,CAAC;CAEJ;AA3DD,sCA2DC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthMethod.js","sourceRoot":"","sources":["../../../filters/auth/AuthMethod.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;AAEH,0DAAqD;AAErD,oFAA+E;AAC/E,+CAA0C;AAG1C,MAAsB,UAAW,SAAQ,2BAAY;IAArD;;QAkBW,aAAQ,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"AuthMethod.js","sourceRoot":"","sources":["../../../filters/auth/AuthMethod.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;AAEH,0DAAqD;AAErD,oFAA+E;AAC/E,+CAA0C;AAG1C,MAAsB,UAAW,SAAQ,2BAAY;IAArD;;QAkBW,aAAQ,GAAG,EAAE,CAAC;IAyDzB,CAAC;IAvDgB,YAAY,CAAC,MAAW,EAAE,OAAgB,EAAE,QAAkB;;;YACvE,IAAI,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAClC,MAAA,IAAI,CAAC,IAAI,mCAAI,IAAI,iBAAO,EAAE,EAC1B,OAAO,EACP,QAAQ,CACX,CAAA;YAGD,aAAa;YACb,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAE5B,IAAI,QAAQ,KAAK,IAAI,EAAE;gBACnB,OAAO,IAAI,CAAC;aACf;YAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACzB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC7B,OAAO,KAAK,CAAC;;KAChB;IAED,YAAY,CAAC,IAAa,EAAE,OAAgB,EAAE,QAAkB;IAEhE,CAAC;IAED,aAAa;IACb,SAAS,CAAC,QAAkB;IAE5B,CAAC;IAED,aAAa;IACb,aAAa,CAAC,QAAkB;QAC5B,MAAM,IAAI,qDAAyB,CAAC,iDAAiD,CAAC,CAAC;IAC3F,CAAC;IAED,cAAc,CAAC,OAAY,EAAE,OAAY;QACrC,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;QACvF,IAAI,GAAG,EAAE;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;SACvB;QAED,OAAO,IAAI,CAAA;IACf,CAAC;IAED,YAAY,CAAC,UAAc,EAAE,OAAc;QACvC,IAAI,OAAO,EAAE;YACT,IAAI,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACvC,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/B,OAAO,OAAO,CAAC;aAClB;iBAAM;gBACH,OAAO,IAAI,CAAA;aACd;SACJ;QAED,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AA3ED,gCA2EC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -45,12 +45,11 @@ class JwtHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
|
45
45
|
this.user = (_a = BaseChyz_1.default.getComponent("user")) !== null && _a !== void 0 ? _a : null;
|
|
46
46
|
}
|
|
47
47
|
authenticate(user, request, response) {
|
|
48
|
-
return __awaiter(this,
|
|
48
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
49
49
|
let autHeader = this.getHeaderByKey(request.headers, this.header);
|
|
50
50
|
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
// BaseChyz.debug("JSON Web Token.",autHeader);
|
|
54
53
|
let identity = null;
|
|
55
54
|
let token = null;
|
|
56
55
|
token = JsonWebToken.decode(autHeader[1], { complete: true });
|
|
@@ -60,7 +59,7 @@ class JwtHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
|
60
59
|
}
|
|
61
60
|
if (token !== null) {
|
|
62
61
|
if (this.auth != null) {
|
|
63
|
-
identity = yield this.auth(autHeader[1]);
|
|
62
|
+
identity = yield this.auth(autHeader[1], ...arguments);
|
|
64
63
|
}
|
|
65
64
|
else {
|
|
66
65
|
identity = yield user.loginByAccessToken(autHeader[1], "JwtHttpBearerAuth");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JwtHttpBearerAuth.js","sourceRoot":"","sources":["../../../filters/auth/JwtHttpBearerAuth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,8DAAsC;AACtC,qDAAgD;AAChD,8EAAyE;AAKzE,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE7C,MAAa,iBAAkB,SAAQ,+BAAc;IAArD;;QACI;;;WAGG;QACI,QAAG,GAAG,KAAK,CAAA;QACX,SAAI,GAAO,IAAI,CAAC;IA0D3B,CAAC;IAvDG;;OAEG;IACI,IAAI;;QACP,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,MAAM,IAAI,+CAAsB,CAAC,2EAA2E,CAAC,CAAC;SACjH;QAED,IAAI,CAAC,IAAI,GAAG,MAAA,kBAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,mCAAI,IAAI,CAAC;IACtD,CAAC;IAGY,YAAY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;gBACvF,OAAO,IAAI,CAAC;aACf;YAGD,IAAI,QAAQ,GAAG,IAAI,CAAC;YACpB,IAAI,KAAK,GAAG,IAAI,CAAC;YAEjB,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;YAC3D,IAAI,CAAC,KAAK,EAAE;gBACR,kBAAQ,CAAC,OAAO,CAAC,+DAA+D,CAAC,CAAC;gBAClF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aACvB;YAED,IAAI,KAAK,KAAK,IAAI,EAAE;gBAChB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;oBACnB,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAC,GAAG,SAAS,CAAC,CAAA;iBACxD;qBAAM;oBACH,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAA;iBAC9E;aACJ;YAED,IAAI,QAAQ,IAAI,IAAI;gBAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAGzC,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAGD;;OAEG;IACI,IAAI,CAAC,QAAiB;QACzB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CAEJ;AAhED,8CAgEC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chyz",
|
|
3
|
+
"version": "1.2.4-rc.3",
|
|
4
|
+
"description": "Nodejs Micro service Framework",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "nodemon -t --trace-warnings index.ts",
|
|
7
|
+
"debug": "ts-node index.ts",
|
|
8
|
+
"build": "rmdir /S /Q .\\dist && npx tsc && xcopy .\\log .\\dist\\log /e /i /h /Y && copy .\\package.json .\\dist\\package.json",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
+
"postversion": "git push && git push --tags"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/cihan53/Chy-Nodejs-Framework.git"
|
|
15
|
+
},
|
|
16
|
+
"author": "Cihan Ozturk",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/cihan53/Chy-Nodejs-Framework/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"axios": "^0.23.0",
|
|
24
|
+
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
25
|
+
"body-parser": "^1.19.0",
|
|
26
|
+
"dotenv-flow": "^3.2.0",
|
|
27
|
+
"express": "^4.17.1",
|
|
28
|
+
"express-session": "^1.17.2",
|
|
29
|
+
"glob": "^7.1.7",
|
|
30
|
+
"ip": "^1.1.5",
|
|
31
|
+
"jsonwebtoken": "^8.5.1",
|
|
32
|
+
"lodash": "^4.17.21",
|
|
33
|
+
"log4js": "^6.3.0",
|
|
34
|
+
"method-override": "^3.0.0",
|
|
35
|
+
"passport": "^0.4.1",
|
|
36
|
+
"pg": "^8.7.1",
|
|
37
|
+
"pg-hstore": "^2.3.4",
|
|
38
|
+
"reflect-metadata": "^0.1.13",
|
|
39
|
+
"sequelize": "^6.6.5",
|
|
40
|
+
"sequelize-transparent-cache": "^2.3.0",
|
|
41
|
+
"validate.js": "^0.13.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/express": "^4.17.13",
|
|
45
|
+
"@types/node": "^16.6.1",
|
|
46
|
+
"@types/validator": "^13.6.3",
|
|
47
|
+
"nodemon": "^2.0.12",
|
|
48
|
+
"ts-node": "^10.2.0",
|
|
49
|
+
"typescript": "^4.3.5"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"Framework",
|
|
53
|
+
"RespAPI",
|
|
54
|
+
"microservice",
|
|
55
|
+
"micro service",
|
|
56
|
+
"easy configuration",
|
|
57
|
+
"Rbac support"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|