chyz 1.2.4-rc.5 → 1.2.5-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/BaseChyz.js +17 -6
  2. package/BaseChyz.js.map +1 -1
  3. package/Chyz.js +4 -2
  4. package/Chyz.js.map +1 -1
  5. package/base/ActionFilter.js +15 -4
  6. package/base/ActionFilter.js.map +1 -1
  7. package/base/BaseError.js +4 -2
  8. package/base/BaseError.js.map +1 -1
  9. package/base/BaseObject.js +4 -2
  10. package/base/BaseObject.js.map +1 -1
  11. package/base/CWebController.js +10 -2
  12. package/base/CWebController.js.map +1 -1
  13. package/base/Component.js +4 -2
  14. package/base/Component.js.map +1 -1
  15. package/base/DbConnection.js +14 -3
  16. package/base/DbConnection.js.map +1 -1
  17. package/base/Model.js +17 -6
  18. package/base/Model.js.map +1 -1
  19. package/base/index.js +35 -19
  20. package/base/index.js.map +1 -1
  21. package/decorator/index.js +7 -4
  22. package/decorator/index.js.map +1 -1
  23. package/filters/AccessControl.js +15 -4
  24. package/filters/AccessControl.js.map +1 -1
  25. package/filters/AccessRule.js +15 -4
  26. package/filters/AccessRule.js.map +1 -1
  27. package/filters/auth/AuthMethod.js +10 -2
  28. package/filters/auth/AuthMethod.js.map +1 -1
  29. package/filters/auth/HttpBasicAuth.js +14 -3
  30. package/filters/auth/HttpBasicAuth.js.map +1 -1
  31. package/filters/auth/HttpHeaderAuth.js +14 -3
  32. package/filters/auth/HttpHeaderAuth.js.map +1 -1
  33. package/filters/auth/JwtHttpBearerAuth.js +14 -3
  34. package/filters/auth/JwtHttpBearerAuth.js.map +1 -1
  35. package/filters/auth/KeyCloakHttpBearerAuth.js +15 -4
  36. package/filters/auth/KeyCloakHttpBearerAuth.js.map +1 -1
  37. package/filters/auth/index.js +9 -5
  38. package/filters/auth/index.js.map +1 -1
  39. package/filters/index.js +5 -3
  40. package/filters/index.js.map +1 -1
  41. package/index.js +55 -8
  42. package/index.js.map +1 -1
  43. package/package.json +1 -2
  44. package/rbac/AuthManager.js +29 -18
  45. package/rbac/AuthManager.js.map +1 -1
  46. package/requiments/Utils.js +61 -1
  47. package/requiments/Utils.js.map +1 -1
  48. package/web/WebUser.js +16 -5
  49. package/web/WebUser.js.map +1 -1
  50. package/BaseChyz.d.ts +0 -62
  51. package/Chyz.d.ts +0 -3
  52. package/base/ActionFilter.d.ts +0 -26
  53. package/base/BaseError.d.ts +0 -10
  54. package/base/BaseObject.d.ts +0 -4
  55. package/base/Behavior.d.ts +0 -3
  56. package/base/CWebController.d.ts +0 -43
  57. package/base/Component.d.ts +0 -21
  58. package/base/Configurable.d.ts +0 -2
  59. package/base/DataErrorDbException.d.ts +0 -5
  60. package/base/DbConnection.d.ts +0 -12
  61. package/base/ForbiddenHttpException.d.ts +0 -4
  62. package/base/InvalidArgumentException.d.ts +0 -5
  63. package/base/InvalidConfigException.d.ts +0 -5
  64. package/base/Model.d.ts +0 -298
  65. package/base/ModelManager.d.ts +0 -1
  66. package/base/NotFoundHttpException.d.ts +0 -5
  67. package/base/RestClient.d.ts +0 -8
  68. package/base/UnauthorizedHttpException.d.ts +0 -5
  69. package/base/ValidationHttpException.d.ts +0 -5
  70. package/base/db/Exception.d.ts +0 -6
  71. package/base/index.d.ts +0 -18
  72. package/decorator/Middleware.d.ts +0 -3
  73. package/decorator/controller.d.ts +0 -2
  74. package/decorator/enums/ControllerDecoratorParams.d.ts +0 -5
  75. package/decorator/get.d.ts +0 -2
  76. package/decorator/index.d.ts +0 -3
  77. package/decorator/post.d.ts +0 -2
  78. package/filters/AccessControl.d.ts +0 -11
  79. package/filters/AccessRule.d.ts +0 -82
  80. package/filters/auth/AuthInterface.d.ts +0 -25
  81. package/filters/auth/AuthMethod.d.ts +0 -25
  82. package/filters/auth/HttpBasicAuth.d.ts +0 -22
  83. package/filters/auth/HttpBearerAuth.d.ts +0 -17
  84. package/filters/auth/HttpHeaderAuth.d.ts +0 -14
  85. package/filters/auth/JwtHttpBearerAuth.d.ts +0 -20
  86. package/filters/auth/KeyCloakHttpBearerAuth.d.ts +0 -22
  87. package/filters/auth/index.d.ts +0 -4
  88. package/filters/index.d.ts +0 -2
  89. package/index.d.ts +0 -15
  90. package/model/RouteDefinition.d.ts +0 -6
  91. package/rbac/AuthAssignment.d.ts +0 -18
  92. package/rbac/AuthItem.d.ts +0 -26
  93. package/rbac/AuthItemChild.d.ts +0 -18
  94. package/rbac/AuthManager.d.ts +0 -111
  95. package/requiments/Glob.d.ts +0 -2
  96. package/requiments/ReflectUtil.d.ts +0 -0
  97. package/requiments/Utils.d.ts +0 -2
  98. package/validators/BooleanValidator.d.ts +0 -0
  99. package/validators/CompareValidator.d.ts +0 -0
  100. package/validators/DateValidator.d.ts +0 -0
  101. package/validators/EmailValidator.d.ts +0 -0
  102. package/validators/Validator.d.ts +0 -17
  103. package/web/IdentityInterface.d.ts +0 -54
  104. package/web/WebUser.d.ts +0 -71
package/base/Model.d.ts DELETED
@@ -1,298 +0,0 @@
1
- import { Component } from "./Component";
2
- import { Model as SModel } from "sequelize";
3
- export { DataTypes, NOW } from "sequelize";
4
- export interface Relation {
5
- type: "hasOne" | "hasMany" | "belongsToMany" | "belongsTo";
6
- allowNull?: boolean;
7
- sourceKey?: string;
8
- model: SModel;
9
- foreignKey: string;
10
- name?: string;
11
- through?: any;
12
- as?: string;
13
- }
14
- /**
15
- * ValidateMe.init({
16
- bar: {
17
- type: Sequelize.STRING,
18
- validate: {
19
- is: ["^[a-z]+$",'i'], // will only allow letters
20
- is: /^[a-z]+$/i, // same as the previous example using real RegExp
21
- not: ["[a-z]",'i'], // will not allow letters
22
- isEmail: true, // checks for email format (foo@bar.com)
23
- isUrl: true, // checks for url format (http://foo.com)
24
- isIP: true, // checks for IPv4 (129.89.23.1) or IPv6 format
25
- isIPv4: true, // checks for IPv4 (129.89.23.1)
26
- isIPv6: true, // checks for IPv6 format
27
- isAlpha: true, // will only allow letters
28
- isAlphanumeric: true, // will only allow alphanumeric characters, so "_abc" will fail
29
- isNumeric: true, // will only allow numbers
30
- isInt: true, // checks for valid integers
31
- isFloat: true, // checks for valid floating point numbers
32
- isDecimal: true, // checks for any numbers
33
- isLowercase: true, // checks for lowercase
34
- isUppercase: true, // checks for uppercase
35
- notNull: true, // won't allow null
36
- isNull: true, // only allows null
37
- notEmpty: true, // don't allow empty strings
38
- equals: 'specific value', // only allow a specific value
39
- contains: 'foo', // force specific substrings
40
- notIn: [['foo', 'bar']], // check the value is not one of these
41
- isIn: [['foo', 'bar']], // check the value is one of these
42
- notContains: 'bar', // don't allow specific substrings
43
- len: [2,10], // only allow values with length between 2 and 10
44
- isUUID: 4, // only allow uuids
45
- isDate: true, // only allow date strings
46
- isAfter: "2011-11-05", // only allow date strings after a specific date
47
- isBefore: "2011-11-05", // only allow date strings before a specific date
48
- max: 23, // only allow values <= 23
49
- min: 23, // only allow values >= 23
50
- isCreditCard: true, // check for valid credit card numbers
51
-
52
- // Examples of custom validators:
53
- isEven(value) {
54
- if (parseInt(value) % 2 !== 0) {
55
- throw new Error('Only even values are allowed!');
56
- }
57
- }
58
- isGreaterThanOtherField(value) {
59
- if (parseInt(value) <= parseInt(this.otherField)) {
60
- throw new Error('Bar must be greater than otherField.');
61
- }
62
- }
63
- }
64
- }
65
- }, { sequelize });
66
- */
67
- export declare class Model extends Component {
68
- _sequelize: any;
69
- _register: any;
70
- private _tableName;
71
- private _model;
72
- private _attributes;
73
- private _errors;
74
- constructor(sequelize?: IDBDatabase);
75
- /**
76
- * Returns the database connection used by this AR class.
77
- * By default, the "db" application component is used as the database connection.
78
- * You may override this method if you want to use a different database connection.
79
- * @return Connection the database connection used by this AR class.
80
- */
81
- getDb(): any;
82
- getDbConnection(): any;
83
- get sequelize(): any;
84
- set sequelize(value: any);
85
- provider(): any;
86
- /**
87
- *
88
- */
89
- get errors(): any;
90
- set errors(value: any);
91
- init(): void;
92
- alias(): string;
93
- tableName(): string;
94
- formName(): string;
95
- rules(): never[];
96
- setModel(value: any): void;
97
- model(): any;
98
- save(params?: {}, options?: {}): Promise<any>;
99
- bulkCreate(params?: {}, options?: {}): Promise<any>;
100
- update(params?: {}, options?: {}): any;
101
- delete(params?: {}, options?: {}): any;
102
- /**
103
- * As there are often use cases in which it is just easier to execute raw / already prepared SQL queries, you can use the sequelize.query method.
104
- *
105
- * By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc). Note that since this is a raw query, the metadata are dialect specific. Some dialects return the metadata "within" the results object (as properties on an array). However, two arguments will always be returned, but for MSSQL and MySQL it will be two references to the same object.
106
- *
107
- * const [results, metadata] = await sequelize.query("UPDATE users SET y = 42 WHERE x = 12");
108
- * // Results will be an empty array and metadata will contain the number of affected rows.
109
- *
110
- * In cases where you don't need to access the metadata you can pass in a query type to tell sequelize how to format the results. For example, for a simple select query you could do:
111
- *
112
- * const { QueryTypes } = require('@sequelize/core');
113
- * const users = await sequelize.query("SELECT * FROM `users`", { type: QueryTypes.SELECT });
114
- * // We didn't need to destructure the result here - the results were returned directly
115
- *
116
- * Several other query types are available. Peek into the source for details.
117
- *
118
- * A second option is the model. If you pass a model the returned data will be instances of that model.
119
- *
120
- * // Callee is the model definition. This allows you to easily map a query to a predefined model
121
- * const projects = await sequelize.query('SELECT * FROM projects', {
122
- * model: Projects,
123
- * mapToModel: true // pass true here if you have any mapped fields
124
- * });
125
- * // Each element of `projects` is now an instance of Project
126
- *
127
- * See more options in the query API reference. Some examples:
128
- * ``
129
- * const { QueryTypes } = require('@sequelize/core');
130
- * await sequelize.query('SELECT 1', {
131
- * // A function (or false) for logging your queries
132
- * // Will get called for every SQL query that gets sent
133
- * // to the server.
134
- * logging: console.log,
135
- *
136
- * // If plain is true, then sequelize will only return the first
137
- * // record of the result set. In case of false it will return all records.
138
- * plain: false,
139
- *
140
- * // Set this to true if you don't have a model definition for your query.
141
- * raw: false,
142
- *
143
- * // The type of query you are executing. The query type affects how results are formatted before they are passed back.
144
- * type: QueryTypes.SELECT
145
- * });
146
- *``
147
- * // Note the second argument being null!
148
- * // Even if we declared a callee here, the raw: true would
149
- * // supersede and return a raw object.
150
- * console.log(await sequelize.query('SELECT * FROM projects', { raw: true }));
151
- *
152
- * ##"Dotted" attributes and the nest option
153
- *
154
- * If an attribute name of the table contains dots, the resulting objects can become nested objects by setting the nest: true option. This is achieved with dottie.js under the hood. See below:
155
- *
156
- * Without nest: true:
157
- * ``
158
- * const { QueryTypes } = require('@sequelize/core');
159
- * const records = await sequelize.query('select 1 as `foo.bar.baz`', {
160
- * type: QueryTypes.SELECT
161
- * });
162
- * console.log(JSON.stringify(records[0], null, 2));
163
- *
164
- * {
165
- * "foo.bar.baz": 1
166
- * }
167
- *
168
- * With nest: true:
169
- *
170
- * const { QueryTypes } = require('@sequelize/core');
171
- * const records = await sequelize.query('select 1 as `foo.bar.baz`', {
172
- * nest: true,
173
- * type: QueryTypes.SELECT
174
- * });
175
- * console.log(JSON.stringify(records[0], null, 2));
176
- *
177
- * {
178
- * "foo": {
179
- * "bar": {
180
- * "baz": 1
181
- * }
182
- * }
183
- * }
184
- * ``
185
- * ##Replacements
186
- *
187
- * Replacements in a query can be done in two different ways, either using named parameters (starting with :), or unnamed, represented by a ?. Replacements are passed in the options object.
188
- *
189
- * If an array is passed, ? will be replaced in the order that they appear in the array
190
- * If an object is passed, :key will be replaced with the keys from that object. If the object contains keys not found in the query or vice versa, an exception will be thrown.
191
- * ``
192
- * const { QueryTypes } = require('@sequelize/core');
193
- *
194
- * await sequelize.query(
195
- * 'SELECT * FROM projects WHERE status = ?',
196
- * {
197
- * replacements: ['active'],
198
- * type: QueryTypes.SELECT
199
- * }
200
- * );
201
- *
202
- * await sequelize.query(
203
- * 'SELECT * FROM projects WHERE status = :status',
204
- * {
205
- * replacements: { status: 'active' },
206
- * type: QueryTypes.SELECT
207
- * }
208
- * );
209
- * ``
210
- * Array replacements will automatically be handled, the following query searches for projects where the status matches an array of values.
211
- * ``
212
- * const { QueryTypes } = require('@sequelize/core');
213
- *
214
- * await sequelize.query(
215
- * 'SELECT * FROM projects WHERE status IN(:status)',
216
- * {
217
- * replacements: { status: ['active', 'inactive'] },
218
- * type: QueryTypes.SELECT
219
- * }
220
- * );
221
- * ``
222
- * To use the wildcard operator %, append it to your replacement. The following query matches users with names that start with 'ben'.
223
- * ``
224
- * const { QueryTypes } = require('@sequelize/core');
225
- *
226
- * await sequelize.query(
227
- * 'SELECT * FROM users WHERE name LIKE :search_name',
228
- * {
229
- * replacements: { search_name: 'ben%' },
230
- * type: QueryTypes.SELECT
231
- * }
232
- * ); ``
233
- *
234
- * ##Bind Parameter
235
- *
236
- * Bind parameters are like replacements. Except replacements are escaped and inserted into the query by sequelize before the query is sent to the database, while bind parameters are sent to the database outside the SQL query text. A query can have either bind parameters or replacements. Bind parameters are referred to by either $1, $2, ... (numeric) or $key (alpha-numeric). This is independent of the dialect.
237
- *
238
- * If an array is passed, $1 is bound to the 1st element in the array (bind[0])
239
- * If an object is passed, $key is bound to object['key']. Each key must begin with a non-numeric char. $1 is not a valid key, even if object['1'] exists.
240
- * In either case $$ can be used to escape a literal $ sign.
241
- *
242
- * The array or object must contain all bound values or Sequelize will throw an exception. This applies even to cases in which the database may ignore the bound parameter.
243
- *
244
- * The database may add further restrictions to this. Bind parameters cannot be SQL keywords, nor table or column names. They are also ignored in quoted text or data. In PostgreSQL it may also be needed to typecast them, if the type cannot be inferred from the context $1::varchar.
245
- *``
246
- * const { QueryTypes } = require('@sequelize/core');
247
- *
248
- * await sequelize.query(
249
- * 'SELECT *, "text with literal $$1 and literal $$status" as t FROM projects WHERE status = $1',
250
- * {
251
- * bind: ['active'],
252
- * type: QueryTypes.SELECT
253
- * }
254
- * ); ``
255
- *
256
- * `` await sequelize.query(
257
- * 'SELECT *, "text with literal $$1 and literal $$status" as t FROM projects WHERE status = $status',
258
- * {
259
- * bind: { status: 'active' },
260
- * type: QueryTypes.SELECT
261
- * }
262
- * );``
263
- * @param query
264
- */
265
- rawQuery(query: string, options?: any): Promise<any>;
266
- /**
267
- *
268
- * @param args
269
- */
270
- findOne(...args: any[]): any;
271
- /**
272
- *
273
- * @param args
274
- */
275
- findAll(...args: any[]): any;
276
- /**
277
- * return {count : number , rows: any}
278
- * @param args
279
- */
280
- findAndCountAll(...args: any[]): any;
281
- validate(): void;
282
- /**
283
- *
284
- * @param data
285
- * @param formName
286
- */
287
- load(data: any, formName?: any): boolean;
288
- bulkLoad(data: any, formName?: any): boolean;
289
- setAttribute(values: any, safeOnly?: boolean): void;
290
- attributes(): {};
291
- /**
292
- * relation return array
293
- * [
294
- *
295
- * ]
296
- */
297
- relations(): Relation[];
298
- }
@@ -1 +0,0 @@
1
- export declare const ModelManager: any;
@@ -1,5 +0,0 @@
1
- import { BaseError } from "./BaseError";
2
- export declare class NotFoundHttpException extends BaseError {
3
- message: string;
4
- constructor(message: string);
5
- }
@@ -1,8 +0,0 @@
1
- import { Component } from "./Component";
2
- export declare class RestClient extends Component {
3
- post(url: string, args: any[], headers?: any): any;
4
- get(url: string, args: any[], headers?: any): any;
5
- Rest(params: any): any;
6
- }
7
- declare const _default: RestClient;
8
- export default _default;
@@ -1,5 +0,0 @@
1
- import { BaseError } from "./BaseError";
2
- export declare class UnauthorizedHttpException extends BaseError {
3
- message: string;
4
- constructor(message: string);
5
- }
@@ -1,5 +0,0 @@
1
- import { BaseError } from "./BaseError";
2
- export declare class ValidationHttpException extends BaseError {
3
- message: string;
4
- constructor(message: string);
5
- }
@@ -1,6 +0,0 @@
1
- import { BaseError } from "../BaseError";
2
- export declare class Exception extends BaseError {
3
- errorInfo: never[];
4
- private code;
5
- constructor(message: string, errorInfo?: any, code?: string, previous?: null);
6
- }
package/base/index.d.ts DELETED
@@ -1,18 +0,0 @@
1
- export * from "./ActionFilter";
2
- export * from "./BaseObject";
3
- export * from "./BaseError";
4
- export * from "./Behavior";
5
- export * from "./Component";
6
- export * from "./Configurable";
7
- export * from "./CWebController";
8
- export * from "./DbConnection";
9
- export * from "./ForbiddenHttpException";
10
- export * from "./InvalidConfigException";
11
- export * from "./InvalidArgumentException";
12
- export * from "./NotFoundHttpException";
13
- export * from "./UnauthorizedHttpException";
14
- export * from "./DataErrorDbException";
15
- export * from "./ValidationHttpException";
16
- export * from "./Model";
17
- export * from "./RestClient";
18
- export * from "./ModelManager";
@@ -1,3 +0,0 @@
1
- import "reflect-metadata";
2
- import { RequestHandler } from "express";
3
- export declare function Middleware(middlewares: RequestHandler[]): Function;
@@ -1,2 +0,0 @@
1
- import "reflect-metadata";
2
- export declare const controller: (prefix?: string) => ClassDecorator;
@@ -1,5 +0,0 @@
1
- export declare enum ControllerDecoratorParams {
2
- Path = "path",
3
- Method = "method",
4
- Middleware = "middleware"
5
- }
@@ -1,2 +0,0 @@
1
- import "reflect-metadata";
2
- export declare const get: (path: string) => MethodDecorator;
@@ -1,3 +0,0 @@
1
- export * from "./controller";
2
- export * from "./get";
3
- export * from "./post";
@@ -1,2 +0,0 @@
1
- import "reflect-metadata";
2
- export declare const post: (path: string) => MethodDecorator;
@@ -1,11 +0,0 @@
1
- import { ActionFilter } from "../base/ActionFilter";
2
- import { WebUser } from "../web/WebUser";
3
- import { Request } from "express";
4
- export declare class AccessControl extends ActionFilter {
5
- user: any;
6
- rules: any;
7
- denyCallback: any;
8
- init(): void;
9
- beforeAction(action: any, request: Request): Promise<boolean>;
10
- denyAccess(user: WebUser): void;
11
- }
@@ -1,82 +0,0 @@
1
- import { WebUser } from "../web/WebUser";
2
- import { Component } from "../base/Component";
3
- import { Request } from "express";
4
- export declare class AccessRule extends Component {
5
- /**
6
- * @var bool whether this is an 'allow' rule or 'deny' rule.
7
- */
8
- allow: any;
9
- /**
10
- * @var array list of action IDs that this rule applies to. The comparison is case-sensitive.
11
- * If not set or empty, it means this rule applies to all actions.
12
- */
13
- actions: any;
14
- /**
15
- * @var array list of the controller IDs that this rule applies to.
16
- */
17
- controllers: any;
18
- /**
19
- * - `?`: matches a guest user (not authenticated yet)
20
- * - `@`: matches an authenticated user
21
- */
22
- roles: any;
23
- /**
24
- * @var array list of RBAC (Role-Based Access Control) permissions that this rules applies to.
25
- */
26
- permissions: any;
27
- /**
28
- * @var array|Closure parameters to pass to the [[User::can()]] function for evaluating
29
- * user permissions in [[$roles]].
30
- *
31
- * If this is an array, it will be passed directly to [[User::can()]]. For example for passing an
32
- * ID from the current request, you may use the following:
33
- *
34
- * ```php
35
- * ['postId' => Yii::$app->request->get('id')]
36
- * ```
37
- *
38
- * You may also specify a closure that returns an array. This can be used to
39
- * evaluate the array values only if they are needed, for example when a model needs to be
40
- * loaded like in the following code:
41
- *
42
- * ```php
43
- * 'rules' => [
44
- * [
45
- * 'allow' => true,
46
- * 'actions' => ['update'],
47
- * 'roles' => ['updatePost'],
48
- * 'roleParams' => function($rule) {
49
- * return ['post' => Post::findOne(Yii::$app->request->get('id'))];
50
- * },
51
- * ],
52
- * ],
53
- * ```
54
- *
55
- * A reference to the [[AccessRule]] instance will be passed to the closure as the first parameter.
56
- *
57
- * @see roles
58
- * @since 2.0.12
59
- */
60
- roleParams: any;
61
- /**
62
- * @var array list of user IP addresses that this rule applies to. An IP address
63
- * can contain the wildcard `*` at the end so that it matches IP addresses with the same prefix.
64
- * For example, '192.168.*' matches all IP addresses in the segment '192.168.'.
65
- * It may also contain a pattern/mask like '172.16.0.0/12' which would match all IPs from the
66
- * 20-bit private network block in RFC1918.
67
- * If not set or empty, it means this rule applies to all IP addresses.
68
- */
69
- ips: any;
70
- allows(action: any, user: WebUser, request: Request): Promise<any>;
71
- /**
72
- * @param Action $action the action
73
- * @return bool whether the rule applies to the action
74
- */
75
- protected matchAction(action: any): any;
76
- /**
77
- * @param Controller $controller the controller
78
- * @return bool whether the rule applies to the controller
79
- */
80
- protected matchController(controller: any): boolean;
81
- protected matchRole(user: WebUser): Promise<boolean>;
82
- }
@@ -1,25 +0,0 @@
1
- import { Request, Response } from "express";
2
- export interface AuthInterface {
3
- /**
4
- * Authenticates the current user.
5
- * @param User $user
6
- * @param Request $request
7
- * @param Response $response
8
- * @return IdentityInterface the authenticated user identity. If authentication information is not provided, null will be returned.
9
- * @throws UnauthorizedHttpException if authentication information is provided but is invalid.
10
- */
11
- authenticate(user: any, request: Request, response: Response): any;
12
- /**
13
- * Generates challenges upon authentication failure.
14
- * For example, some appropriate HTTP headers may be generated.
15
- * @param Response $response
16
- */
17
- challenge(response: Response): Response;
18
- /**
19
- * Handles authentication failure.
20
- * The implementation should normally throw UnauthorizedHttpException to indicate authentication failure.
21
- * @param Response $response
22
- * @throws UnauthorizedHttpException
23
- */
24
- handleFailure(response: Response): Response;
25
- }
@@ -1,25 +0,0 @@
1
- import { ActionFilter } from "../../base/ActionFilter";
2
- import { AuthInterface } from "./AuthInterface";
3
- import { WebUser } from "../../web/WebUser";
4
- import { Request, Response } from "express";
5
- export declare abstract class AuthMethod extends ActionFilter implements AuthInterface {
6
- /**
7
- * @var User the user object representing the user authentication status. If not set, the `user` application component will be used.
8
- */
9
- user: WebUser | undefined;
10
- /**
11
- * @var Request the current request. If not set, the `request` application component will be used.
12
- */
13
- request: Request | undefined;
14
- /**
15
- * @var Response the response to be sent. If not set, the `response` application component will be used.
16
- */
17
- response: Response | undefined;
18
- optional: never[];
19
- beforeAction(action: any, request: Request, response: Response): Promise<boolean>;
20
- authenticate(user: WebUser, request: Request, response: Response): void;
21
- challenge(response: Response): void;
22
- handleFailure(response: Response): void;
23
- getHeaderByKey(headers: any, findKey: any): any;
24
- patternCheck(headerText: any, pattern: RegExp): any;
25
- }
@@ -1,22 +0,0 @@
1
- import { Request, Response } from "express";
2
- import { WebUser } from "../../web/WebUser";
3
- import { AuthMethod } from "./AuthMethod";
4
- export declare class HttpBasicAuth extends AuthMethod {
5
- /**
6
- * @var string the HTTP header name
7
- */
8
- header: string;
9
- /**
10
- * @var string a pattern to use to extract the HTTP authentication value
11
- */
12
- pattern: RegExp;
13
- /**
14
- * @throws InvalidConfigException
15
- */
16
- init(): void;
17
- authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
18
- /**
19
- * @throws UnauthorizedHttpException
20
- */
21
- fail(response: Response): void;
22
- }
@@ -1,17 +0,0 @@
1
- import { HttpHeaderAuth } from "./HttpHeaderAuth";
2
- import { Response } from "express";
3
- export declare class HttpBearerAuth extends HttpHeaderAuth {
4
- /**
5
- * {@inheritdoc}
6
- */
7
- header: string;
8
- pattern: RegExp;
9
- /**
10
- * @var string the HTTP authentication realm
11
- */
12
- realm: string;
13
- /**
14
- * {@inheritdoc}
15
- */
16
- challenge(response: Response): void;
17
- }
@@ -1,14 +0,0 @@
1
- import { AuthMethod } from "./AuthMethod";
2
- import { WebUser } from "../../web/WebUser";
3
- import { Request, Response } from "express";
4
- export declare class HttpHeaderAuth extends AuthMethod {
5
- /**
6
- * @var string the HTTP header name
7
- */
8
- header: string;
9
- /**
10
- * @var string a pattern to use to extract the HTTP authentication value
11
- */
12
- pattern: string;
13
- authenticate(user: WebUser, request: Request, response: Response): Promise<any>;
14
- }
@@ -1,20 +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
- }
@@ -1,22 +0,0 @@
1
- import { HttpBearerAuth } from "./HttpBearerAuth";
2
- import { Response, Request } 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
- }
@@ -1,4 +0,0 @@
1
- export * from "./JwtHttpBearerAuth";
2
- export * from "./HttpBearerAuth";
3
- export * from "./HttpHeaderAuth";
4
- export * from "./HttpBasicAuth";
@@ -1,2 +0,0 @@
1
- export * from "./AccessControl";
2
- export * from "./AccessRule";
package/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export { Request, Response, NextFunction } from "express";
2
- export * from "./base";
3
- export * from "./filters";
4
- export * from "./filters/auth";
5
- export * from "./decorator";
6
- export * from "./requiments/Utils";
7
- export { RouteDefinition } from "./model/RouteDefinition";
8
- export { WebUser } from "./web/WebUser";
9
- import BaseChyz from "./BaseChyz";
10
- export { BaseChyz };
11
- /**
12
- *
13
- */
14
- declare const Chyz: BaseChyz;
15
- export default Chyz;