chyz 2.0.1-rc.3 → 2.0.1-rc.36
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 +623 -0
- package/README.md +518 -518
- package/base/ActionFilter.ts +88 -0
- package/base/BadRequestHttpException.ts +14 -0
- package/base/{BaseError.js → BaseError.ts} +26 -18
- package/base/Behavior.ts +6 -0
- package/base/CBaseObject.ts +17 -0
- package/base/CEvents.ts +24 -0
- package/base/{CRequest.js → CRequest.ts} +6 -2
- package/base/CWebController.ts +90 -0
- package/base/Component.ts +66 -0
- package/{model/RouteDefinition.js → base/Configurable.ts} +4 -2
- 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/{Logs.js → Logs.ts} +41 -24
- package/base/{Model.js → Model.ts} +225 -158
- package/base/{ModelManager.js → ModelManager.ts} +7 -7
- package/base/NotFoundHttpException.ts +14 -0
- package/base/RestClient.ts +26 -0
- package/base/UnauthorizedHttpException.ts +17 -0
- package/base/ValidationHttpException.ts +14 -0
- package/base/db/Exception.ts +14 -0
- package/base/index.ts +19 -0
- package/decorator/Middleware.ts +9 -0
- package/decorator/{controller.js → controller.ts} +7 -9
- package/decorator/{delete.js → delete.ts} +9 -9
- package/decorator/enums/ControllerDecoratorParams.ts +5 -0
- package/decorator/{get.js → get.ts} +11 -10
- package/decorator/index.ts +5 -0
- package/decorator/{post.js → post.ts} +10 -10
- package/decorator/{put.js → put.ts} +9 -9
- package/filters/AccessControl.ts +74 -0
- package/filters/AccessRule.ts +182 -0
- package/filters/auth/{AuthInterface.d.ts → AuthInterface.ts} +15 -7
- package/filters/auth/AuthMethod.ts +100 -0
- package/filters/auth/HttpBasicAuth.ts +79 -0
- package/filters/auth/HttpBearerAuth.ts +34 -0
- package/filters/auth/HttpHeaderAuth.ts +61 -0
- package/filters/auth/JwtHttpBearerAuth.ts +83 -0
- package/filters/auth/KeyCloakHttpBearerAuth.ts +114 -0
- package/filters/auth/index.ts +4 -0
- package/filters/index.ts +2 -0
- package/index.ts +80 -0
- package/log/config/log4js.json +55 -55
- package/model/RouteDefinition.ts +18 -0
- package/package.json +63 -61
- package/rbac/AuthAssignment.ts +50 -0
- package/rbac/{AuthItem.js → AuthItem.ts} +22 -16
- package/rbac/{AuthItemChild.js → AuthItemChild.ts} +21 -14
- package/rbac/AuthManager.ts +399 -0
- package/rbac/index.ts +12 -0
- package/{web/IdentityInterface.js → requiments/Glob.ts} +3 -2
- package/requiments/{ReflectUtil.js → ReflectUtil.ts} +6 -4
- package/requiments/{Utils.js → Utils.ts} +40 -34
- 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.d.ts → IdentityInterface.ts} +15 -2
- package/web/WebUser.ts +187 -0
- package/BaseChyz.d.ts +0 -74
- package/BaseChyz.d.ts.map +0 -1
- package/BaseChyz.js +0 -569
- package/base/ActionFilter.d.ts +0 -33
- package/base/ActionFilter.d.ts.map +0 -1
- package/base/ActionFilter.js +0 -90
- package/base/BadRequestHttpException.d.ts +0 -6
- package/base/BadRequestHttpException.d.ts.map +0 -1
- package/base/BadRequestHttpException.js +0 -17
- package/base/BaseError.d.ts +0 -44
- package/base/BaseError.d.ts.map +0 -1
- package/base/Behavior.d.ts +0 -4
- package/base/Behavior.d.ts.map +0 -1
- package/base/Behavior.js +0 -7
- package/base/CBaseObject.d.ts +0 -5
- package/base/CBaseObject.d.ts.map +0 -1
- package/base/CBaseObject.js +0 -16
- package/base/CEvents.d.ts +0 -13
- package/base/CEvents.d.ts.map +0 -1
- package/base/CEvents.js +0 -24
- package/base/CRequest.d.ts +0 -2
- package/base/CRequest.d.ts.map +0 -1
- package/base/CWebController.d.ts +0 -44
- package/base/CWebController.d.ts.map +0 -1
- package/base/CWebController.js +0 -81
- package/base/Component.d.ts +0 -21
- package/base/Component.d.ts.map +0 -1
- package/base/Component.js +0 -57
- package/base/Configurable.d.ts +0 -3
- package/base/Configurable.d.ts.map +0 -1
- package/base/Configurable.js +0 -8
- package/base/DataErrorDbException.d.ts +0 -6
- package/base/DataErrorDbException.d.ts.map +0 -1
- package/base/DataErrorDbException.js +0 -17
- package/base/DbConnection.d.ts +0 -13
- package/base/DbConnection.d.ts.map +0 -1
- package/base/DbConnection.js +0 -53
- package/base/ForbiddenHttpException.d.ts +0 -5
- package/base/ForbiddenHttpException.d.ts.map +0 -1
- package/base/ForbiddenHttpException.js +0 -16
- package/base/InvalidArgumentException.d.ts +0 -6
- package/base/InvalidArgumentException.d.ts.map +0 -1
- package/base/InvalidArgumentException.js +0 -17
- package/base/InvalidConfigException.d.ts +0 -6
- package/base/InvalidConfigException.d.ts.map +0 -1
- package/base/InvalidConfigException.js +0 -17
- package/base/Logs.d.ts +0 -22
- package/base/Logs.d.ts.map +0 -1
- package/base/Model.d.ts +0 -302
- package/base/Model.d.ts.map +0 -1
- package/base/ModelManager.d.ts +0 -2
- package/base/ModelManager.d.ts.map +0 -1
- package/base/NotFoundHttpException.d.ts +0 -6
- package/base/NotFoundHttpException.d.ts.map +0 -1
- package/base/NotFoundHttpException.js +0 -17
- package/base/RestClient.d.ts +0 -7
- package/base/RestClient.d.ts.map +0 -1
- package/base/RestClient.js +0 -25
- package/base/UnauthorizedHttpException.d.ts +0 -6
- package/base/UnauthorizedHttpException.d.ts.map +0 -1
- package/base/UnauthorizedHttpException.js +0 -17
- package/base/ValidationHttpException.d.ts +0 -6
- package/base/ValidationHttpException.d.ts.map +0 -1
- package/base/ValidationHttpException.js +0 -17
- package/base/db/Exception.d.ts +0 -7
- package/base/db/Exception.d.ts.map +0 -1
- package/base/db/Exception.js +0 -15
- package/base/index.d.ts +0 -20
- package/base/index.d.ts.map +0 -1
- package/base/index.js +0 -41
- package/decorator/Middleware.d.ts +0 -4
- package/decorator/Middleware.d.ts.map +0 -1
- package/decorator/Middleware.js +0 -11
- package/decorator/controller.d.ts +0 -3
- package/decorator/controller.d.ts.map +0 -1
- package/decorator/delete.d.ts +0 -3
- package/decorator/delete.d.ts.map +0 -1
- package/decorator/enums/ControllerDecoratorParams.d.ts +0 -6
- package/decorator/enums/ControllerDecoratorParams.d.ts.map +0 -1
- package/decorator/enums/ControllerDecoratorParams.js +0 -9
- package/decorator/get.d.ts +0 -3
- package/decorator/get.d.ts.map +0 -1
- package/decorator/index.d.ts +0 -6
- package/decorator/index.d.ts.map +0 -1
- package/decorator/index.js +0 -13
- package/decorator/post.d.ts +0 -3
- package/decorator/post.d.ts.map +0 -1
- package/decorator/put.d.ts +0 -3
- package/decorator/put.d.ts.map +0 -1
- package/filters/AccessControl.d.ts +0 -13
- package/filters/AccessControl.d.ts.map +0 -1
- package/filters/AccessControl.js +0 -83
- package/filters/AccessRule.d.ts +0 -83
- package/filters/AccessRule.d.ts.map +0 -1
- package/filters/AccessRule.js +0 -136
- package/filters/auth/AuthInterface.d.ts.map +0 -1
- package/filters/auth/AuthInterface.js +0 -2
- package/filters/auth/AuthMethod.d.ts +0 -38
- package/filters/auth/AuthMethod.d.ts.map +0 -1
- package/filters/auth/AuthMethod.js +0 -82
- package/filters/auth/HttpBasicAuth.d.ts +0 -24
- package/filters/auth/HttpBasicAuth.d.ts.map +0 -1
- package/filters/auth/HttpBasicAuth.js +0 -78
- package/filters/auth/HttpBearerAuth.d.ts +0 -18
- package/filters/auth/HttpBearerAuth.d.ts.map +0 -1
- package/filters/auth/HttpBearerAuth.js +0 -33
- package/filters/auth/HttpHeaderAuth.d.ts +0 -19
- package/filters/auth/HttpHeaderAuth.d.ts.map +0 -1
- package/filters/auth/HttpHeaderAuth.js +0 -64
- package/filters/auth/JwtHttpBearerAuth.d.ts +0 -21
- package/filters/auth/JwtHttpBearerAuth.d.ts.map +0 -1
- package/filters/auth/JwtHttpBearerAuth.js +0 -87
- package/filters/auth/KeyCloakHttpBearerAuth.d.ts +0 -23
- package/filters/auth/KeyCloakHttpBearerAuth.d.ts.map +0 -1
- package/filters/auth/KeyCloakHttpBearerAuth.js +0 -116
- package/filters/auth/index.d.ts +0 -5
- package/filters/auth/index.d.ts.map +0 -1
- package/filters/auth/index.js +0 -11
- package/filters/index.d.ts +0 -3
- package/filters/index.d.ts.map +0 -1
- package/filters/index.js +0 -7
- package/index.d.ts +0 -26
- package/index.d.ts.map +0 -1
- package/index.js +0 -72
- package/model/RouteDefinition.d.ts +0 -7
- package/model/RouteDefinition.d.ts.map +0 -1
- package/rbac/AuthAssignment.d.ts +0 -19
- package/rbac/AuthAssignment.d.ts.map +0 -1
- package/rbac/AuthAssignment.js +0 -44
- package/rbac/AuthItem.d.ts +0 -27
- package/rbac/AuthItem.d.ts.map +0 -1
- package/rbac/AuthItemChild.d.ts +0 -19
- package/rbac/AuthItemChild.d.ts.map +0 -1
- package/rbac/AuthManager.d.ts +0 -112
- package/rbac/AuthManager.d.ts.map +0 -1
- package/rbac/AuthManager.js +0 -356
- package/rbac/index.d.ts +0 -5
- package/rbac/index.d.ts.map +0 -1
- package/rbac/index.js +0 -28
- package/requiments/Glob.d.ts +0 -3
- package/requiments/Glob.d.ts.map +0 -1
- package/requiments/Glob.js +0 -10
- package/requiments/ReflectUtil.d.ts +0 -1
- package/requiments/ReflectUtil.d.ts.map +0 -1
- package/requiments/Utils.d.ts +0 -2
- package/requiments/Utils.d.ts.map +0 -1
- package/validators/BooleanValidator.d.ts +0 -1
- package/validators/BooleanValidator.d.ts.map +0 -1
- package/validators/BooleanValidator.js +0 -1
- package/validators/CompareValidator.d.ts +0 -1
- package/validators/CompareValidator.d.ts.map +0 -1
- package/validators/CompareValidator.js +0 -1
- package/validators/DateValidator.d.ts +0 -1
- package/validators/DateValidator.d.ts.map +0 -1
- package/validators/DateValidator.js +0 -1
- package/validators/EmailValidator.d.ts +0 -1
- package/validators/EmailValidator.d.ts.map +0 -1
- package/validators/EmailValidator.js +0 -1
- package/validators/Validator.d.ts +0 -18
- package/validators/Validator.d.ts.map +0 -1
- package/validators/Validator.js +0 -27
- package/web/IdentityInterface.d.ts.map +0 -1
- package/web/WebUser.d.ts +0 -72
- package/web/WebUser.d.ts.map +0 -1
- package/web/WebUser.js +0 -165
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HttpHeaderAuth = void 0;
|
|
19
|
-
const AuthMethod_1 = require("./AuthMethod");
|
|
20
|
-
const Utils_1 = require("../../requiments/Utils");
|
|
21
|
-
class HttpHeaderAuth extends AuthMethod_1.AuthMethod {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...arguments);
|
|
24
|
-
/**
|
|
25
|
-
* @var string the HTTP header name
|
|
26
|
-
*/
|
|
27
|
-
this.header = 'X-Api-Key';
|
|
28
|
-
}
|
|
29
|
-
authenticate(user, request, response) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
let key = Object.keys(request.headers).find(key => key.toLowerCase() === this.header.toLowerCase());
|
|
32
|
-
if (key) {
|
|
33
|
-
let authHeader = request.headers[key];
|
|
34
|
-
if (!Utils_1.Utils.isEmpty(authHeader)) {
|
|
35
|
-
if (this.pattern) {
|
|
36
|
-
//preg_match
|
|
37
|
-
let matches = authHeader.match(this.pattern);
|
|
38
|
-
if (matches && matches.length > 0) {
|
|
39
|
-
authHeader = matches[1];
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return this.fail(response);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
let identity = yield user.loginByAccessToken(authHeader, "HttpHeaderAuth");
|
|
46
|
-
if (identity === null) {
|
|
47
|
-
this.challenge(response);
|
|
48
|
-
this.handleFailure(response);
|
|
49
|
-
}
|
|
50
|
-
return identity;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return this.fail(response);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @throws UnauthorizedHttpException
|
|
58
|
-
*/
|
|
59
|
-
fail(response) {
|
|
60
|
-
this.challenge(response);
|
|
61
|
-
this.handleFailure(response);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.HttpHeaderAuth = HttpHeaderAuth;
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
49
|
-
let autHeader = this.getHeaderByKey(request.headers, this.header);
|
|
50
|
-
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
let identity = null;
|
|
54
|
-
let token = null;
|
|
55
|
-
try {
|
|
56
|
-
token = JsonWebToken.decode(autHeader[1], { complete: true });
|
|
57
|
-
if (!token) {
|
|
58
|
-
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.");
|
|
59
|
-
this.fail(response);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.", autHeader, request.path);
|
|
64
|
-
this.fail(response);
|
|
65
|
-
}
|
|
66
|
-
if (token !== null) {
|
|
67
|
-
if (this.auth != null) {
|
|
68
|
-
identity = yield this.auth(autHeader[1], ...arguments);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
identity = yield user.loginByAccessToken(autHeader[1], "JwtHttpBearerAuth");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (identity == null)
|
|
75
|
-
this.fail(response);
|
|
76
|
-
return identity;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @throws UnauthorizedHttpException
|
|
81
|
-
*/
|
|
82
|
-
fail(response) {
|
|
83
|
-
this.challenge(response);
|
|
84
|
-
this.handleFailure(response);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.JwtHttpBearerAuth = JwtHttpBearerAuth;
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,116 +0,0 @@
|
|
|
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;
|
package/filters/auth/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/filters/auth/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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; } });
|
package/filters/index.d.ts
DELETED
package/filters/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/filters/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AAgBD,eAAO,MAAM,YAAY,KAAgB,CAAC;AAC1C,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/index.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
const Chyz = new BaseChyz_1.default();
|
|
47
|
-
var WebUser_1 = require("./web/WebUser");
|
|
48
|
-
Object.defineProperty(exports, "WebUser", { enumerable: true, get: function () { return WebUser_1.WebUser; } });
|
|
49
|
-
var base_2 = require("./base");
|
|
50
|
-
Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return base_2.Logs; } });
|
|
51
|
-
Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return base_2.ActionFilter; } });
|
|
52
|
-
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_2.BaseError; } });
|
|
53
|
-
Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return base_2.Behavior; } });
|
|
54
|
-
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return base_2.Component; } });
|
|
55
|
-
Object.defineProperty(exports, "CWebController", { enumerable: true, get: function () { return base_2.CWebController; } });
|
|
56
|
-
Object.defineProperty(exports, "DbConnection", { enumerable: true, get: function () { return base_2.DbConnection; } });
|
|
57
|
-
Object.defineProperty(exports, "ForbiddenHttpException", { enumerable: true, get: function () { return base_2.ForbiddenHttpException; } });
|
|
58
|
-
Object.defineProperty(exports, "InvalidConfigException", { enumerable: true, get: function () { return base_2.InvalidConfigException; } });
|
|
59
|
-
Object.defineProperty(exports, "InvalidArgumentException", { enumerable: true, get: function () { return base_2.InvalidArgumentException; } });
|
|
60
|
-
Object.defineProperty(exports, "NotFoundHttpException", { enumerable: true, get: function () { return base_2.NotFoundHttpException; } });
|
|
61
|
-
Object.defineProperty(exports, "UnauthorizedHttpException", { enumerable: true, get: function () { return base_2.UnauthorizedHttpException; } });
|
|
62
|
-
Object.defineProperty(exports, "DataErrorDbException", { enumerable: true, get: function () { return base_2.DataErrorDbException; } });
|
|
63
|
-
Object.defineProperty(exports, "ValidationHttpException", { enumerable: true, get: function () { return base_2.ValidationHttpException; } });
|
|
64
|
-
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return base_2.Model; } });
|
|
65
|
-
Object.defineProperty(exports, "ModelManager", { enumerable: true, get: function () { return base_2.ModelManager; } });
|
|
66
|
-
Object.defineProperty(exports, "CEvents", { enumerable: true, get: function () { return base_2.CEvents; } });
|
|
67
|
-
__exportStar(require("./filters"), exports);
|
|
68
|
-
__exportStar(require("./filters/auth"), exports);
|
|
69
|
-
__exportStar(require("./rbac/"), exports);
|
|
70
|
-
__exportStar(require("./decorator"), exports);
|
|
71
|
-
__exportStar(require("./requiments/Utils"), exports);
|
|
72
|
-
exports.default = Chyz;
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/rbac/AuthAssignment.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/rbac/AuthAssignment.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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;
|
package/rbac/AuthItem.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
|
package/rbac/AuthItem.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/rbac/AuthItemChild.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DataTypes, Model, Relation } from "../base";
|
|
2
|
-
export declare class AuthItemChildClass extends Model {
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
tableName(): string;
|
|
5
|
-
attributes(): {
|
|
6
|
-
parent: {
|
|
7
|
-
type: DataTypes.StringDataTypeConstructor;
|
|
8
|
-
primaryKey: boolean;
|
|
9
|
-
allowNull: boolean;
|
|
10
|
-
};
|
|
11
|
-
child: {
|
|
12
|
-
type: DataTypes.StringDataTypeConstructor;
|
|
13
|
-
allowNull: boolean;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
init(): void;
|
|
17
|
-
relations(): Relation[];
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=AuthItemChild.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthItemChild.d.ts","sourceRoot":"","sources":["../../src/rbac/AuthItemChild.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAgB,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjE,qBAAa,kBAAmB,SAAQ,KAAK;IACzC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEjB,SAAS;IAIT,UAAU;;;;;;;;;;;IAeV,IAAI;IAKJ,SAAS,IAAI,QAAQ,EAAE;CAU1B"}
|