@bluealba/pae-core 0.0.3

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 (170) hide show
  1. package/README.md +9 -0
  2. package/dist/src/authentication/auth-user.interface.d.ts +13 -0
  3. package/dist/src/authentication/auth-user.interface.d.ts.map +1 -0
  4. package/dist/src/authentication/auth-user.interface.js +3 -0
  5. package/dist/src/authentication/auth-user.interface.js.map +1 -0
  6. package/dist/src/authentication/index.d.ts +2 -0
  7. package/dist/src/authentication/index.d.ts.map +1 -0
  8. package/dist/src/authentication/index.js +18 -0
  9. package/dist/src/authentication/index.js.map +1 -0
  10. package/dist/src/authorization/allowed-resources.interface.d.ts +7 -0
  11. package/dist/src/authorization/allowed-resources.interface.d.ts.map +1 -0
  12. package/dist/src/authorization/allowed-resources.interface.js +3 -0
  13. package/dist/src/authorization/allowed-resources.interface.js.map +1 -0
  14. package/dist/src/authorization/application.model.d.ts +7 -0
  15. package/dist/src/authorization/application.model.d.ts.map +1 -0
  16. package/dist/src/authorization/application.model.js +14 -0
  17. package/dist/src/authorization/application.model.js.map +1 -0
  18. package/dist/src/authorization/authorization-repository.interface.d.ts +9 -0
  19. package/dist/src/authorization/authorization-repository.interface.d.ts.map +1 -0
  20. package/dist/src/authorization/authorization-repository.interface.js +3 -0
  21. package/dist/src/authorization/authorization-repository.interface.js.map +1 -0
  22. package/dist/src/authorization/authorization.service.d.ts +13 -0
  23. package/dist/src/authorization/authorization.service.d.ts.map +1 -0
  24. package/dist/src/authorization/authorization.service.js +32 -0
  25. package/dist/src/authorization/authorization.service.js.map +1 -0
  26. package/dist/src/authorization/constants.d.ts +3 -0
  27. package/dist/src/authorization/constants.d.ts.map +1 -0
  28. package/dist/src/authorization/constants.js +6 -0
  29. package/dist/src/authorization/constants.js.map +1 -0
  30. package/dist/src/authorization/index.d.ts +6 -0
  31. package/dist/src/authorization/index.d.ts.map +1 -0
  32. package/dist/src/authorization/index.js +26 -0
  33. package/dist/src/authorization/index.js.map +1 -0
  34. package/dist/src/authorization/operation.model.d.ts +10 -0
  35. package/dist/src/authorization/operation.model.d.ts.map +1 -0
  36. package/dist/src/authorization/operation.model.js +19 -0
  37. package/dist/src/authorization/operation.model.js.map +1 -0
  38. package/dist/src/authorization/repositories/http.repository.d.ts +15 -0
  39. package/dist/src/authorization/repositories/http.repository.d.ts.map +1 -0
  40. package/dist/src/authorization/repositories/http.repository.js +157 -0
  41. package/dist/src/authorization/repositories/http.repository.js.map +1 -0
  42. package/dist/src/authorization/repositories/index.d.ts +2 -0
  43. package/dist/src/authorization/repositories/index.d.ts.map +1 -0
  44. package/dist/src/authorization/repositories/index.js +18 -0
  45. package/dist/src/authorization/repositories/index.js.map +1 -0
  46. package/dist/src/authorization/rule.model.d.ts +11 -0
  47. package/dist/src/authorization/rule.model.d.ts.map +1 -0
  48. package/dist/src/authorization/rule.model.js +18 -0
  49. package/dist/src/authorization/rule.model.js.map +1 -0
  50. package/dist/src/authorization/utilities/filter-app-operations.d.ts +3 -0
  51. package/dist/src/authorization/utilities/filter-app-operations.d.ts.map +1 -0
  52. package/dist/src/authorization/utilities/filter-app-operations.js +8 -0
  53. package/dist/src/authorization/utilities/filter-app-operations.js.map +1 -0
  54. package/dist/src/authorization/utilities/get-operations.utility.d.ts +8 -0
  55. package/dist/src/authorization/utilities/get-operations.utility.d.ts.map +1 -0
  56. package/dist/src/authorization/utilities/get-operations.utility.js +33 -0
  57. package/dist/src/authorization/utilities/get-operations.utility.js.map +1 -0
  58. package/dist/src/authorization/utilities/get-route-operations.d.ts +4 -0
  59. package/dist/src/authorization/utilities/get-route-operations.d.ts.map +1 -0
  60. package/dist/src/authorization/utilities/get-route-operations.js +45 -0
  61. package/dist/src/authorization/utilities/get-route-operations.js.map +1 -0
  62. package/dist/src/authorization/utilities/index.d.ts +2 -0
  63. package/dist/src/authorization/utilities/index.d.ts.map +1 -0
  64. package/dist/src/authorization/utilities/index.js +6 -0
  65. package/dist/src/authorization/utilities/index.js.map +1 -0
  66. package/dist/src/authorization/utilities/is-authorized.utility.d.ts +6 -0
  67. package/dist/src/authorization/utilities/is-authorized.utility.d.ts.map +1 -0
  68. package/dist/src/authorization/utilities/is-authorized.utility.js +21 -0
  69. package/dist/src/authorization/utilities/is-authorized.utility.js.map +1 -0
  70. package/dist/src/catalog/authorization.interface.d.ts +11 -0
  71. package/dist/src/catalog/authorization.interface.d.ts.map +1 -0
  72. package/dist/src/catalog/authorization.interface.js +3 -0
  73. package/dist/src/catalog/authorization.interface.js.map +1 -0
  74. package/dist/src/catalog/catalog-repository.interface.d.ts +5 -0
  75. package/dist/src/catalog/catalog-repository.interface.d.ts.map +1 -0
  76. package/dist/src/catalog/catalog-repository.interface.js +3 -0
  77. package/dist/src/catalog/catalog-repository.interface.js.map +1 -0
  78. package/dist/src/catalog/catalog.service.d.ts +10 -0
  79. package/dist/src/catalog/catalog.service.d.ts.map +1 -0
  80. package/dist/src/catalog/catalog.service.js +32 -0
  81. package/dist/src/catalog/catalog.service.js.map +1 -0
  82. package/dist/src/catalog/index.d.ts +6 -0
  83. package/dist/src/catalog/index.d.ts.map +1 -0
  84. package/dist/src/catalog/index.js +23 -0
  85. package/dist/src/catalog/index.js.map +1 -0
  86. package/dist/src/catalog/module-metadata.interface.d.ts +47 -0
  87. package/dist/src/catalog/module-metadata.interface.d.ts.map +1 -0
  88. package/dist/src/catalog/module-metadata.interface.js +3 -0
  89. package/dist/src/catalog/module-metadata.interface.js.map +1 -0
  90. package/dist/src/catalog/repositories/http.repository.d.ts +9 -0
  91. package/dist/src/catalog/repositories/http.repository.d.ts.map +1 -0
  92. package/dist/src/catalog/repositories/http.repository.js +40 -0
  93. package/dist/src/catalog/repositories/http.repository.js.map +1 -0
  94. package/dist/src/catalog/repositories/index.d.ts +2 -0
  95. package/dist/src/catalog/repositories/index.d.ts.map +1 -0
  96. package/dist/src/catalog/repositories/index.js +18 -0
  97. package/dist/src/catalog/repositories/index.js.map +1 -0
  98. package/dist/src/catalog/service-config.interface.d.ts +17 -0
  99. package/dist/src/catalog/service-config.interface.d.ts.map +1 -0
  100. package/dist/src/catalog/service-config.interface.js +3 -0
  101. package/dist/src/catalog/service-config.interface.js.map +1 -0
  102. package/dist/src/catalog/ui-config.interface.d.ts +27 -0
  103. package/dist/src/catalog/ui-config.interface.d.ts.map +1 -0
  104. package/dist/src/catalog/ui-config.interface.js +3 -0
  105. package/dist/src/catalog/ui-config.interface.js.map +1 -0
  106. package/dist/src/catalog/ui-types.constants.d.ts +2 -0
  107. package/dist/src/catalog/ui-types.constants.d.ts.map +1 -0
  108. package/dist/src/catalog/ui-types.constants.js +5 -0
  109. package/dist/src/catalog/ui-types.constants.js.map +1 -0
  110. package/dist/src/catalog/versions/enrichAppWithVersionMetadata.d.ts +8 -0
  111. package/dist/src/catalog/versions/enrichAppWithVersionMetadata.d.ts.map +1 -0
  112. package/dist/src/catalog/versions/enrichAppWithVersionMetadata.js +50 -0
  113. package/dist/src/catalog/versions/enrichAppWithVersionMetadata.js.map +1 -0
  114. package/dist/src/catalog/versions/fetchRuntimeMetadata.d.ts +13 -0
  115. package/dist/src/catalog/versions/fetchRuntimeMetadata.d.ts.map +1 -0
  116. package/dist/src/catalog/versions/fetchRuntimeMetadata.js +45 -0
  117. package/dist/src/catalog/versions/fetchRuntimeMetadata.js.map +1 -0
  118. package/dist/src/gateway/gateway.service.d.ts +7 -0
  119. package/dist/src/gateway/gateway.service.d.ts.map +1 -0
  120. package/dist/src/gateway/gateway.service.js +13 -0
  121. package/dist/src/gateway/gateway.service.js.map +1 -0
  122. package/dist/src/gateway/get-from-header.d.ts +3 -0
  123. package/dist/src/gateway/get-from-header.d.ts.map +1 -0
  124. package/dist/src/gateway/get-from-header.js +11 -0
  125. package/dist/src/gateway/get-from-header.js.map +1 -0
  126. package/dist/src/gateway/headers.d.ts +5 -0
  127. package/dist/src/gateway/headers.d.ts.map +1 -0
  128. package/dist/src/gateway/headers.js +8 -0
  129. package/dist/src/gateway/headers.js.map +1 -0
  130. package/dist/src/index.d.ts +6 -0
  131. package/dist/src/index.d.ts.map +1 -0
  132. package/dist/src/index.js +24 -0
  133. package/dist/src/index.js.map +1 -0
  134. package/dist/src/pae/config.interface.d.ts +15 -0
  135. package/dist/src/pae/config.interface.d.ts.map +1 -0
  136. package/dist/src/pae/config.interface.js +3 -0
  137. package/dist/src/pae/config.interface.js.map +1 -0
  138. package/dist/src/pae/index.d.ts +2 -0
  139. package/dist/src/pae/index.d.ts.map +1 -0
  140. package/dist/src/pae/index.js +18 -0
  141. package/dist/src/pae/index.js.map +1 -0
  142. package/dist/src/pae/pae.d.ts +17 -0
  143. package/dist/src/pae/pae.d.ts.map +1 -0
  144. package/dist/src/pae/pae.js +110 -0
  145. package/dist/src/pae/pae.js.map +1 -0
  146. package/dist/src/user/group.interface.d.ts +2 -0
  147. package/dist/src/user/group.interface.d.ts.map +1 -0
  148. package/dist/src/user/group.interface.js +3 -0
  149. package/dist/src/user/group.interface.js.map +1 -0
  150. package/dist/src/user/repositories/http.repository.d.ts +8 -0
  151. package/dist/src/user/repositories/http.repository.d.ts.map +1 -0
  152. package/dist/src/user/repositories/http.repository.js +39 -0
  153. package/dist/src/user/repositories/http.repository.js.map +1 -0
  154. package/dist/src/user/repositories/index.d.ts +2 -0
  155. package/dist/src/user/repositories/index.d.ts.map +1 -0
  156. package/dist/src/user/repositories/index.js +18 -0
  157. package/dist/src/user/repositories/index.js.map +1 -0
  158. package/dist/src/user/user-repository.interface.d.ts +5 -0
  159. package/dist/src/user/user-repository.interface.d.ts.map +1 -0
  160. package/dist/src/user/user-repository.interface.js +3 -0
  161. package/dist/src/user/user-repository.interface.js.map +1 -0
  162. package/dist/src/user/user.service.d.ts +7 -0
  163. package/dist/src/user/user.service.d.ts.map +1 -0
  164. package/dist/src/user/user.service.js +25 -0
  165. package/dist/src/user/user.service.js.map +1 -0
  166. package/dist/src/utilities.d.ts +3 -0
  167. package/dist/src/utilities.d.ts.map +1 -0
  168. package/dist/src/utilities.js +19 -0
  169. package/dist/src/utilities.js.map +1 -0
  170. package/package.json +32 -0
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # PAE CORE Library
2
+ This library is a collection of common utilities and services that are used across all PAE services.
3
+
4
+ ## Common environment variables
5
+ ```env
6
+ PAE_CATALOG_SERVICE_URL=http://pae-apps-catalog-service
7
+ PAE_AUTHZ_SERVICE_URL=http://pae-authorization-service
8
+ PAE_USERS_SERVICE_URL=http://pae-user-service
9
+ ```
@@ -0,0 +1,13 @@
1
+ import { Application } from "../authorization/application.model";
2
+ import { Operation } from "../authorization/operation.model";
3
+ export interface AuthUser {
4
+ username: string;
5
+ displayName: string;
6
+ operations: Operation[];
7
+ applications: Application[];
8
+ impersonatedBy?: {
9
+ username: string;
10
+ displayName: string;
11
+ };
12
+ }
13
+ //# sourceMappingURL=auth-user.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-user.interface.d.ts","sourceRoot":"","sources":["../../../src/authentication/auth-user.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=auth-user.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-user.interface.js","sourceRoot":"","sources":["../../../src/authentication/auth-user.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './auth-user.interface';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authentication/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth-user.interface"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
@@ -0,0 +1,7 @@
1
+ import { Application } from "./application.model";
2
+ import { Operation } from "./operation.model";
3
+ export interface AllowedResources {
4
+ operations: Operation[];
5
+ applications: Application[];
6
+ }
7
+ //# sourceMappingURL=allowed-resources.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-resources.interface.d.ts","sourceRoot":"","sources":["../../../src/authorization/allowed-resources.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=allowed-resources.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-resources.interface.js","sourceRoot":"","sources":["../../../src/authorization/allowed-resources.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare class Application {
2
+ readonly name: string;
3
+ readonly description?: string | undefined;
4
+ private constructor();
5
+ static create(name: string, description?: string): Application;
6
+ }
7
+ //# sourceMappingURL=application.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.model.d.ts","sourceRoot":"","sources":["../../../src/authorization/application.model.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;aAEJ,IAAI,EAAE,MAAM;aACZ,WAAW,CAAC;IAF9B,OAAO;WAKO,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,WAAW;CAGtE"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Application = void 0;
4
+ class Application {
5
+ constructor(name, description) {
6
+ this.name = name;
7
+ this.description = description;
8
+ }
9
+ static create(name, description) {
10
+ return new Application(name, description);
11
+ }
12
+ }
13
+ exports.Application = Application;
14
+ //# sourceMappingURL=application.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.model.js","sourceRoot":"","sources":["../../../src/authorization/application.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IACtB,YACkB,IAAY,EACZ,WAAoB;QADpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAS;IACnC,CAAC;IAEG,MAAM,CAAC,MAAM,CAAC,IAAY,EAAE,WAAoB;QACrD,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;CACF;AATD,kCASC"}
@@ -0,0 +1,9 @@
1
+ import { AllowedResources } from "./allowed-resources.interface";
2
+ import { Application } from "./application.model";
3
+ import { Operation } from "./operation.model";
4
+ export interface AuthorizationRepository {
5
+ getAllOperations(): Promise<Operation[]>;
6
+ getAllApplications(): Promise<Application[]>;
7
+ getAllowedResources(username: string, userGroups: string[]): Promise<AllowedResources>;
8
+ }
9
+ //# sourceMappingURL=authorization-repository.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-repository.interface.d.ts","sourceRoot":"","sources":["../../../src/authorization/authorization-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACzC,kBAAkB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACxF"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=authorization-repository.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-repository.interface.js","sourceRoot":"","sources":["../../../src/authorization/authorization-repository.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { AuthorizationRepository } from "./authorization-repository.interface";
2
+ import { UserService } from "../user/user.service";
3
+ import { AllowedResources } from "./allowed-resources.interface";
4
+ export declare class AuthorizationService {
5
+ private readonly authzRepository;
6
+ private readonly userService;
7
+ constructor(authzRepository: AuthorizationRepository, userService: UserService);
8
+ getAllowedResources(username: string): Promise<AllowedResources>;
9
+ get utils(): {
10
+ isAuthorized: (module: import("..").ModuleMetadata, catalog: import("..").ModuleMetadata[], allowedApplications: import("./application.model").Application[], allowedOperations: import("./operation.model").Operation[], requestPath?: string | undefined, requestMethod?: import("../catalog/authorization.interface").HttpMethod) => boolean;
11
+ };
12
+ }
13
+ //# sourceMappingURL=authorization.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.service.d.ts","sourceRoot":"","sources":["../../../src/authorization/authorization.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,eAAe,EAAE,uBAAuB,EACxC,WAAW,EAAE,WAAW;IAGrC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAKtE,IAAI,KAAK;;MAIR;CACF"}
@@ -0,0 +1,32 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuthorizationService = void 0;
13
+ const utilities_1 = require("./utilities");
14
+ class AuthorizationService {
15
+ constructor(authzRepository, userService) {
16
+ this.authzRepository = authzRepository;
17
+ this.userService = userService;
18
+ }
19
+ getAllowedResources(username) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const userGroups = yield this.userService.findGroups(username);
22
+ return this.authzRepository.getAllowedResources(username, userGroups);
23
+ });
24
+ }
25
+ get utils() {
26
+ return {
27
+ isAuthorized: utilities_1.isAuthorized,
28
+ };
29
+ }
30
+ }
31
+ exports.AuthorizationService = AuthorizationService;
32
+ //# sourceMappingURL=authorization.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.service.js","sourceRoot":"","sources":["../../../src/authorization/authorization.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,2CAA2C;AAE3C,MAAa,oBAAoB;IAC/B,YACmB,eAAwC,EACxC,WAAwB;QADxB,oBAAe,GAAf,eAAe,CAAyB;QACxC,gBAAW,GAAX,WAAW,CAAa;IACvC,CAAC;IAEC,mBAAmB,CAAC,QAAgB;;YACxC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACxE,CAAC;KAAA;IAED,IAAI,KAAK;QACP,OAAO;YACL,YAAY,EAAZ,wBAAY;SACb,CAAC;IACJ,CAAC;CACF;AAhBD,oDAgBC"}
@@ -0,0 +1,3 @@
1
+ export declare const ROUTE_PATTERN_WILD_CARD = "(.*)";
2
+ export declare const ROUTE_PATTERN_PARAMETER = ":";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/authorization/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,SAAS,CAAC;AAE9C,eAAO,MAAM,uBAAuB,MAAM,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ROUTE_PATTERN_PARAMETER = exports.ROUTE_PATTERN_WILD_CARD = void 0;
4
+ exports.ROUTE_PATTERN_WILD_CARD = "(.*)";
5
+ exports.ROUTE_PATTERN_PARAMETER = ":";
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/authorization/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,MAAM,CAAC;AAEjC,QAAA,uBAAuB,GAAG,GAAG,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { AuthorizationService } from './authorization.service';
2
+ export { Operation } from './operation.model';
3
+ export { Application } from './application.model';
4
+ export * from './repositories';
5
+ export * from './utilities';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Application = exports.Operation = exports.AuthorizationService = void 0;
18
+ var authorization_service_1 = require("./authorization.service");
19
+ Object.defineProperty(exports, "AuthorizationService", { enumerable: true, get: function () { return authorization_service_1.AuthorizationService; } });
20
+ var operation_model_1 = require("./operation.model");
21
+ Object.defineProperty(exports, "Operation", { enumerable: true, get: function () { return operation_model_1.Operation; } });
22
+ var application_model_1 = require("./application.model");
23
+ Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_model_1.Application; } });
24
+ __exportStar(require("./repositories"), exports);
25
+ __exportStar(require("./utilities"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authorization/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iEAA+D;AAAtD,6HAAA,oBAAoB,OAAA;AAC7B,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAClB,yDAAkD;AAAzC,gHAAA,WAAW,OAAA;AACpB,iDAA+B;AAC/B,8CAA4B"}
@@ -0,0 +1,10 @@
1
+ export declare class Operation {
2
+ name: string;
3
+ description?: string;
4
+ applications: string[];
5
+ roles: string[];
6
+ private constructor();
7
+ get isGlobal(): boolean;
8
+ static create(name: string, description?: string, applications?: string[], roles?: string[]): Operation;
9
+ }
10
+ //# sourceMappingURL=operation.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.model.d.ts","sourceRoot":"","sources":["../../../src/authorization/operation.model.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB,OAAO;IAOP,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,EAAO,EAAE,KAAK,GAAE,MAAM,EAAO,GAAG,SAAS;CAGhH"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Operation = void 0;
4
+ class Operation {
5
+ constructor(name, description, applications = [], roles = []) {
6
+ this.name = name;
7
+ this.description = description;
8
+ this.applications = applications;
9
+ this.roles = roles;
10
+ }
11
+ get isGlobal() {
12
+ return this.applications.length === 0;
13
+ }
14
+ static create(name, description, applications = [], roles = []) {
15
+ return new Operation(name, description, applications, roles);
16
+ }
17
+ }
18
+ exports.Operation = Operation;
19
+ //# sourceMappingURL=operation.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.model.js","sourceRoot":"","sources":["../../../src/authorization/operation.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAMpB,YAAoB,IAAY,EAAE,WAAoB,EAAE,eAAyB,EAAE,EAAE,QAAkB,EAAE;QACvG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,IAAY,EAAE,WAAoB,EAAE,eAAyB,EAAE,EAAE,QAAkB,EAAE;QACjG,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;CACF;AApBD,8BAoBC"}
@@ -0,0 +1,15 @@
1
+ import { AllowedResources } from "../allowed-resources.interface";
2
+ import { Application } from "../application.model";
3
+ import { AuthorizationRepository } from "../authorization-repository.interface";
4
+ import { Operation } from "../operation.model";
5
+ import { Rule } from "../rule.model";
6
+ export declare class AuthorizationHttpRepository implements AuthorizationRepository {
7
+ private readonly authzServiceUrl;
8
+ private readonly sessionCookie;
9
+ constructor(authzServiceUrl: string, sessionCookie?: string);
10
+ getAllOperations(): Promise<Operation[]>;
11
+ getAllApplications(): Promise<Application[]>;
12
+ getRules(username: string, userGroups?: string[]): Promise<Rule[]>;
13
+ getAllowedResources(username: string, userGroups: string[]): Promise<AllowedResources>;
14
+ }
15
+ //# sourceMappingURL=http.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.repository.d.ts","sourceRoot":"","sources":["../../../../src/authorization/repositories/http.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,qBAAa,2BAA4B,YAAW,uBAAuB;IAEvE,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBADb,eAAe,EAAE,MAAM,EACvB,aAAa,GAAE,MAAW;IAGvC,gBAAgB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAqBxC,kBAAkB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAmB5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAiCtE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAgG7F"}
@@ -0,0 +1,157 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuthorizationHttpRepository = void 0;
13
+ const application_model_1 = require("../application.model");
14
+ const operation_model_1 = require("../operation.model");
15
+ const rule_model_1 = require("../rule.model");
16
+ class AuthorizationHttpRepository {
17
+ constructor(authzServiceUrl, sessionCookie = '') {
18
+ this.authzServiceUrl = authzServiceUrl;
19
+ this.sessionCookie = sessionCookie;
20
+ }
21
+ getAllOperations() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const response = yield fetch(`${this.authzServiceUrl}/operations`, {
24
+ headers: {
25
+ 'Cookie': this.sessionCookie
26
+ }
27
+ });
28
+ if (!response.ok) {
29
+ throw new Error('Failed to fetch operations');
30
+ }
31
+ const data = yield response.json();
32
+ return data.map(operation => operation_model_1.Operation.create(operation.name, operation.description, operation.applications, operation.roles));
33
+ });
34
+ }
35
+ getAllApplications() {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const response = yield fetch(`${this.authzServiceUrl}/applications`, {
38
+ headers: {
39
+ 'Cookie': this.sessionCookie
40
+ }
41
+ });
42
+ if (!response.ok) {
43
+ throw new Error('Failed to fetch applications');
44
+ }
45
+ const data = yield response.json();
46
+ return data.map(application => application_model_1.Application.create(application.name, application.description));
47
+ });
48
+ }
49
+ getRules(username_1) {
50
+ return __awaiter(this, arguments, void 0, function* (username, userGroups = []) {
51
+ const url = new URL(`${this.authzServiceUrl}/rules`);
52
+ url.searchParams.append('username', username);
53
+ if (userGroups.length > 0) {
54
+ userGroups.forEach(group => {
55
+ url.searchParams.append('userGroups', group);
56
+ });
57
+ }
58
+ const response = yield fetch(url, {
59
+ headers: {
60
+ 'Cookie': this.sessionCookie
61
+ }
62
+ });
63
+ if (!response.ok) {
64
+ throw new Error('Failed to fetch rules');
65
+ }
66
+ const data = yield response.json();
67
+ return data.map(rule => rule_model_1.Rule.create(rule.id, rule.subjectType, rule.subject, rule.resourceType, rule.resource, rule.denied));
68
+ });
69
+ }
70
+ getAllowedResources(username, userGroups) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const allOperations = yield this.getAllOperations();
73
+ const allApplications = yield this.getAllApplications();
74
+ const rules = yield this.getRules(username, userGroups);
75
+ const { deniedRules, allowedRules } = rules.reduce((acc, rule) => {
76
+ if (rule.denied) {
77
+ acc.deniedRules.push(rule);
78
+ }
79
+ else {
80
+ acc.allowedRules.push(rule);
81
+ }
82
+ return acc;
83
+ }, {
84
+ deniedRules: [],
85
+ allowedRules: []
86
+ });
87
+ const allowedResources = allowedRules.reduce((allowedResources, rule) => {
88
+ if (rule.subjectType === "group" && userGroups.includes(rule.subject)) {
89
+ if (rule.resourceType === "operation") {
90
+ const operation = allOperations.find(op => op.name === rule.resource);
91
+ if (operation) {
92
+ allowedResources.operations.push(operation);
93
+ }
94
+ }
95
+ if (rule.resourceType === "role") {
96
+ const operations = allOperations.filter(op => op.roles.includes(rule.resource));
97
+ allowedResources.operations.push(...operations);
98
+ }
99
+ if (rule.resourceType === "application") {
100
+ const application = allApplications.find(app => app.name === rule.resource);
101
+ if (application) {
102
+ allowedResources.applications.push(application);
103
+ }
104
+ }
105
+ }
106
+ if (rule.subjectType === "user" && rule.subject === username) {
107
+ if (rule.resourceType === "operation") {
108
+ const operation = allOperations.find(op => op.name === rule.resource);
109
+ if (operation) {
110
+ allowedResources.operations.push(operation);
111
+ }
112
+ }
113
+ if (rule.resourceType === "role") {
114
+ const operations = allOperations.filter(op => op.roles.includes(rule.resource));
115
+ allowedResources.operations.push(...operations);
116
+ }
117
+ if (rule.resourceType === "application") {
118
+ const application = allApplications.find(app => app.name === rule.resource);
119
+ if (application) {
120
+ allowedResources.applications.push(application);
121
+ }
122
+ }
123
+ }
124
+ return allowedResources;
125
+ }, {
126
+ operations: [],
127
+ applications: []
128
+ });
129
+ deniedRules.forEach(rule => {
130
+ if (rule.resourceType === "operation") {
131
+ const operationIndex = allowedResources.operations.findIndex(op => op.name === rule.resource);
132
+ if (operationIndex !== -1) {
133
+ allowedResources.operations.splice(operationIndex, 1);
134
+ }
135
+ }
136
+ if (rule.resourceType === "role") {
137
+ const operations = allOperations.filter(op => op.roles.includes(rule.resource));
138
+ operations.forEach(operation => {
139
+ const operationIndex = allowedResources.operations.findIndex(op => op.name === operation.name);
140
+ if (operationIndex !== -1) {
141
+ allowedResources.operations.splice(operationIndex, 1);
142
+ }
143
+ });
144
+ }
145
+ if (rule.resourceType === "application") {
146
+ const applicationIndex = allowedResources.applications.findIndex(app => app.name === rule.resource);
147
+ if (applicationIndex !== -1) {
148
+ allowedResources.applications.splice(applicationIndex, 1);
149
+ }
150
+ }
151
+ });
152
+ return allowedResources;
153
+ });
154
+ }
155
+ }
156
+ exports.AuthorizationHttpRepository = AuthorizationHttpRepository;
157
+ //# sourceMappingURL=http.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.repository.js","sourceRoot":"","sources":["../../../../src/authorization/repositories/http.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAAmD;AAEnD,wDAA+C;AAC/C,8CAAqC;AAErC,MAAa,2BAA2B;IACtC,YACmB,eAAuB,EACvB,gBAAwB,EAAE;QAD1B,oBAAe,GAAf,eAAe,CAAQ;QACvB,kBAAa,GAAb,aAAa,CAAa;IACzC,CAAC;IAEC,gBAAgB;;YACpB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,eA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AAgB,EAAE,CAAC,CAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,gBAAgB,CAAC;QAC1B,CAAC;KAAA;CACF;AA/KD,kEA+KC"}
@@ -0,0 +1,2 @@
1
+ export * from './http.repository';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/authorization/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./http.repository"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/authorization/repositories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
@@ -0,0 +1,11 @@
1
+ export declare class Rule {
2
+ readonly id: number;
3
+ readonly subjectType: string;
4
+ readonly subject: string;
5
+ readonly resourceType: string;
6
+ readonly resource: string;
7
+ readonly denied: boolean;
8
+ private constructor();
9
+ static create(id: number, subjectType: string, subject: string, resourceType: string, resource: string, denied: boolean): Rule;
10
+ }
11
+ //# sourceMappingURL=rule.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule.model.d.ts","sourceRoot":"","sources":["../../../src/authorization/rule.model.ts"],"names":[],"mappings":"AAAA,qBAAa,IAAI;aAEG,EAAE,EAAE,MAAM;aACV,WAAW,EAAE,MAAM;aACnB,OAAO,EAAE,MAAM;aACf,YAAY,EAAE,MAAM;aACpB,QAAQ,EAAE,MAAM;aAChB,MAAM,EAAE,OAAO;IANjC,OAAO;IASP,MAAM,CAAC,MAAM,CACX,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,IAAI;CAIR"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Rule = void 0;
4
+ class Rule {
5
+ constructor(id, subjectType, subject, resourceType, resource, denied) {
6
+ this.id = id;
7
+ this.subjectType = subjectType;
8
+ this.subject = subject;
9
+ this.resourceType = resourceType;
10
+ this.resource = resource;
11
+ this.denied = denied;
12
+ }
13
+ static create(id, subjectType, subject, resourceType, resource, denied) {
14
+ return new Rule(id, subjectType, subject, resourceType, resource, denied);
15
+ }
16
+ }
17
+ exports.Rule = Rule;
18
+ //# sourceMappingURL=rule.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule.model.js","sourceRoot":"","sources":["../../../src/authorization/rule.model.ts"],"names":[],"mappings":";;;AAAA,MAAa,IAAI;IACf,YACkB,EAAU,EACV,WAAmB,EACnB,OAAe,EACf,YAAoB,EACpB,QAAgB,EAChB,MAAe;QALf,OAAE,GAAF,EAAE,CAAQ;QACV,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAQ;QACf,iBAAY,GAAZ,YAAY,CAAQ;QACpB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAS;IAC7B,CAAC;IAEL,MAAM,CAAC,MAAM,CACX,EAAU,EACV,WAAmB,EACnB,OAAe,EACf,YAAoB,EACpB,QAAgB,EAChB,MAAe;QAEf,OAAO,IAAI,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;CAEF;AArBD,oBAqBC"}
@@ -0,0 +1,3 @@
1
+ import { Operation } from "../operation.model";
2
+ export declare function filterAppOperations(allowedOperations: Operation[], applications?: string[]): Operation[];
3
+ //# sourceMappingURL=filter-app-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-app-operations.d.ts","sourceRoot":"","sources":["../../../../src/authorization/utilities/filter-app-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,SAAS,EAAE,EAAE,YAAY,GAAE,MAAM,EAAO,GAAG,SAAS,EAAE,CAE5G"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterAppOperations = void 0;
4
+ function filterAppOperations(allowedOperations, applications = []) {
5
+ return allowedOperations.filter(op => op.applications.length === 0 || op.applications.some(app => applications.includes(app)));
6
+ }
7
+ exports.filterAppOperations = filterAppOperations;
8
+ //# sourceMappingURL=filter-app-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-app-operations.js","sourceRoot":"","sources":["../../../../src/authorization/utilities/filter-app-operations.ts"],"names":[],"mappings":";;;AAEA,SAAgB,mBAAmB,CAAC,iBAA8B,EAAE,eAAyB,EAAE;IAC7F,OAAO,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjI,CAAC;AAFD,kDAEC"}
@@ -0,0 +1,8 @@
1
+ import { ModuleMetadata } from "../../catalog";
2
+ import { HttpMethod } from "../../catalog/authorization.interface";
3
+ export interface ModuleRequirements {
4
+ operations: string[];
5
+ applications: string[];
6
+ }
7
+ export declare const getModuleRequirements: (module: ModuleMetadata, catalog: ModuleMetadata[], requestPath?: string, requestMethod?: HttpMethod) => ModuleRequirements;
8
+ //# sourceMappingURL=get-operations.utility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-operations.utility.d.ts","sourceRoot":"","sources":["../../../../src/authorization/utilities/get-operations.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAGnE,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,eAAO,MAAM,qBAAqB,WACxB,cAAc,WACb,cAAc,EAAE,gBACZ,MAAM,kBACL,UAAU,KACvB,kBA+BF,CAAA"}