@minimaltech/node-infra 0.5.9-30 → 0.5.9-32

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.
@@ -204,7 +204,7 @@ class TzCrudRepository extends base_repository_1.AbstractTzRepository {
204
204
  if (options === null || options === void 0 ? void 0 : options.newInstance) {
205
205
  entity.createdAt = new Date();
206
206
  }
207
- if (!options.ignoreModified && 'modifiedAt' in entity) {
207
+ if (!options.ignoreModified) {
208
208
  entity.modifiedAt = new Date();
209
209
  }
210
210
  return entity;
@@ -3,6 +3,7 @@ import { Context } from '@loopback/core';
3
3
  import { Request } from '@loopback/rest';
4
4
  export declare const defineOAuth2Strategy: (opts: {
5
5
  name: string;
6
+ requiredAuthProvider?: boolean;
6
7
  baseURL: string;
7
8
  authPath?: string;
8
9
  }) => {
@@ -15,6 +16,7 @@ export declare const defineOAuth2Strategy: (opts: {
15
16
  };
16
17
  export declare const registerOAuth2Strategy: (context: Context, options: {
17
18
  strategyName: string;
19
+ requiredAuthProvider?: boolean;
18
20
  authenticateUrl: string;
19
21
  authenticatePath?: string;
20
22
  }) => void;
@@ -40,6 +40,13 @@ const defineOAuth2Strategy = (opts) => {
40
40
  return __awaiter(this, void 0, void 0, function* () {
41
41
  var _a, _b, _c;
42
42
  const networkService = this.authProvider.getNetworkService();
43
+ if (opts.requiredAuthProvider &&
44
+ (!request.headers['x-auth-provider'] || request.headers['x-auth-provider'] !== this.name)) {
45
+ throw (0, utilities_1.getError)({
46
+ statusCode: common_1.ResultCodes.RS_4.Unauthorized,
47
+ message: 'Invaid authorization provider',
48
+ });
49
+ }
43
50
  if (!request.headers['authorization']) {
44
51
  throw (0, utilities_1.getError)({
45
52
  statusCode: common_1.ResultCodes.RS_4.Unauthorized,
@@ -64,6 +71,7 @@ const registerOAuth2Strategy = (context, options) => {
64
71
  var _a;
65
72
  const remoteOAuth2Strategy = (0, exports.defineOAuth2Strategy)({
66
73
  name: options.strategyName,
74
+ requiredAuthProvider: options.requiredAuthProvider,
67
75
  baseURL: options.authenticateUrl,
68
76
  authPath: (_a = options.authenticatePath) !== null && _a !== void 0 ? _a : '/auth/who-am-i',
69
77
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minimaltech/node-infra",
3
- "version": "0.5.9-30",
3
+ "version": "0.5.9-32",
4
4
  "description": "Minimal Technology - NodeJS Infrastructure - Loopback 4 Framework",
5
5
  "keywords": [
6
6
  "web",