@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.
- package/README.md +9 -0
- package/dist/src/authentication/auth-user.interface.d.ts +13 -0
- package/dist/src/authentication/auth-user.interface.d.ts.map +1 -0
- package/dist/src/authentication/auth-user.interface.js +3 -0
- package/dist/src/authentication/auth-user.interface.js.map +1 -0
- package/dist/src/authentication/index.d.ts +2 -0
- package/dist/src/authentication/index.d.ts.map +1 -0
- package/dist/src/authentication/index.js +18 -0
- package/dist/src/authentication/index.js.map +1 -0
- package/dist/src/authorization/allowed-resources.interface.d.ts +7 -0
- package/dist/src/authorization/allowed-resources.interface.d.ts.map +1 -0
- package/dist/src/authorization/allowed-resources.interface.js +3 -0
- package/dist/src/authorization/allowed-resources.interface.js.map +1 -0
- package/dist/src/authorization/application.model.d.ts +7 -0
- package/dist/src/authorization/application.model.d.ts.map +1 -0
- package/dist/src/authorization/application.model.js +14 -0
- package/dist/src/authorization/application.model.js.map +1 -0
- package/dist/src/authorization/authorization-repository.interface.d.ts +9 -0
- package/dist/src/authorization/authorization-repository.interface.d.ts.map +1 -0
- package/dist/src/authorization/authorization-repository.interface.js +3 -0
- package/dist/src/authorization/authorization-repository.interface.js.map +1 -0
- package/dist/src/authorization/authorization.service.d.ts +13 -0
- package/dist/src/authorization/authorization.service.d.ts.map +1 -0
- package/dist/src/authorization/authorization.service.js +32 -0
- package/dist/src/authorization/authorization.service.js.map +1 -0
- package/dist/src/authorization/constants.d.ts +3 -0
- package/dist/src/authorization/constants.d.ts.map +1 -0
- package/dist/src/authorization/constants.js +6 -0
- package/dist/src/authorization/constants.js.map +1 -0
- package/dist/src/authorization/index.d.ts +6 -0
- package/dist/src/authorization/index.d.ts.map +1 -0
- package/dist/src/authorization/index.js +26 -0
- package/dist/src/authorization/index.js.map +1 -0
- package/dist/src/authorization/operation.model.d.ts +10 -0
- package/dist/src/authorization/operation.model.d.ts.map +1 -0
- package/dist/src/authorization/operation.model.js +19 -0
- package/dist/src/authorization/operation.model.js.map +1 -0
- package/dist/src/authorization/repositories/http.repository.d.ts +15 -0
- package/dist/src/authorization/repositories/http.repository.d.ts.map +1 -0
- package/dist/src/authorization/repositories/http.repository.js +157 -0
- package/dist/src/authorization/repositories/http.repository.js.map +1 -0
- package/dist/src/authorization/repositories/index.d.ts +2 -0
- package/dist/src/authorization/repositories/index.d.ts.map +1 -0
- package/dist/src/authorization/repositories/index.js +18 -0
- package/dist/src/authorization/repositories/index.js.map +1 -0
- package/dist/src/authorization/rule.model.d.ts +11 -0
- package/dist/src/authorization/rule.model.d.ts.map +1 -0
- package/dist/src/authorization/rule.model.js +18 -0
- package/dist/src/authorization/rule.model.js.map +1 -0
- package/dist/src/authorization/utilities/filter-app-operations.d.ts +3 -0
- package/dist/src/authorization/utilities/filter-app-operations.d.ts.map +1 -0
- package/dist/src/authorization/utilities/filter-app-operations.js +8 -0
- package/dist/src/authorization/utilities/filter-app-operations.js.map +1 -0
- package/dist/src/authorization/utilities/get-operations.utility.d.ts +8 -0
- package/dist/src/authorization/utilities/get-operations.utility.d.ts.map +1 -0
- package/dist/src/authorization/utilities/get-operations.utility.js +33 -0
- package/dist/src/authorization/utilities/get-operations.utility.js.map +1 -0
- package/dist/src/authorization/utilities/get-route-operations.d.ts +4 -0
- package/dist/src/authorization/utilities/get-route-operations.d.ts.map +1 -0
- package/dist/src/authorization/utilities/get-route-operations.js +45 -0
- package/dist/src/authorization/utilities/get-route-operations.js.map +1 -0
- package/dist/src/authorization/utilities/index.d.ts +2 -0
- package/dist/src/authorization/utilities/index.d.ts.map +1 -0
- package/dist/src/authorization/utilities/index.js +6 -0
- package/dist/src/authorization/utilities/index.js.map +1 -0
- package/dist/src/authorization/utilities/is-authorized.utility.d.ts +6 -0
- package/dist/src/authorization/utilities/is-authorized.utility.d.ts.map +1 -0
- package/dist/src/authorization/utilities/is-authorized.utility.js +21 -0
- package/dist/src/authorization/utilities/is-authorized.utility.js.map +1 -0
- package/dist/src/catalog/authorization.interface.d.ts +11 -0
- package/dist/src/catalog/authorization.interface.d.ts.map +1 -0
- package/dist/src/catalog/authorization.interface.js +3 -0
- package/dist/src/catalog/authorization.interface.js.map +1 -0
- package/dist/src/catalog/catalog-repository.interface.d.ts +5 -0
- package/dist/src/catalog/catalog-repository.interface.d.ts.map +1 -0
- package/dist/src/catalog/catalog-repository.interface.js +3 -0
- package/dist/src/catalog/catalog-repository.interface.js.map +1 -0
- package/dist/src/catalog/catalog.service.d.ts +10 -0
- package/dist/src/catalog/catalog.service.d.ts.map +1 -0
- package/dist/src/catalog/catalog.service.js +32 -0
- package/dist/src/catalog/catalog.service.js.map +1 -0
- package/dist/src/catalog/index.d.ts +6 -0
- package/dist/src/catalog/index.d.ts.map +1 -0
- package/dist/src/catalog/index.js +23 -0
- package/dist/src/catalog/index.js.map +1 -0
- package/dist/src/catalog/module-metadata.interface.d.ts +47 -0
- package/dist/src/catalog/module-metadata.interface.d.ts.map +1 -0
- package/dist/src/catalog/module-metadata.interface.js +3 -0
- package/dist/src/catalog/module-metadata.interface.js.map +1 -0
- package/dist/src/catalog/repositories/http.repository.d.ts +9 -0
- package/dist/src/catalog/repositories/http.repository.d.ts.map +1 -0
- package/dist/src/catalog/repositories/http.repository.js +40 -0
- package/dist/src/catalog/repositories/http.repository.js.map +1 -0
- package/dist/src/catalog/repositories/index.d.ts +2 -0
- package/dist/src/catalog/repositories/index.d.ts.map +1 -0
- package/dist/src/catalog/repositories/index.js +18 -0
- package/dist/src/catalog/repositories/index.js.map +1 -0
- package/dist/src/catalog/service-config.interface.d.ts +17 -0
- package/dist/src/catalog/service-config.interface.d.ts.map +1 -0
- package/dist/src/catalog/service-config.interface.js +3 -0
- package/dist/src/catalog/service-config.interface.js.map +1 -0
- package/dist/src/catalog/ui-config.interface.d.ts +27 -0
- package/dist/src/catalog/ui-config.interface.d.ts.map +1 -0
- package/dist/src/catalog/ui-config.interface.js +3 -0
- package/dist/src/catalog/ui-config.interface.js.map +1 -0
- package/dist/src/catalog/ui-types.constants.d.ts +2 -0
- package/dist/src/catalog/ui-types.constants.d.ts.map +1 -0
- package/dist/src/catalog/ui-types.constants.js +5 -0
- package/dist/src/catalog/ui-types.constants.js.map +1 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.d.ts +8 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.d.ts.map +1 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.js +50 -0
- package/dist/src/catalog/versions/enrichAppWithVersionMetadata.js.map +1 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.d.ts +13 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.d.ts.map +1 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.js +45 -0
- package/dist/src/catalog/versions/fetchRuntimeMetadata.js.map +1 -0
- package/dist/src/gateway/gateway.service.d.ts +7 -0
- package/dist/src/gateway/gateway.service.d.ts.map +1 -0
- package/dist/src/gateway/gateway.service.js +13 -0
- package/dist/src/gateway/gateway.service.js.map +1 -0
- package/dist/src/gateway/get-from-header.d.ts +3 -0
- package/dist/src/gateway/get-from-header.d.ts.map +1 -0
- package/dist/src/gateway/get-from-header.js +11 -0
- package/dist/src/gateway/get-from-header.js.map +1 -0
- package/dist/src/gateway/headers.d.ts +5 -0
- package/dist/src/gateway/headers.d.ts.map +1 -0
- package/dist/src/gateway/headers.js +8 -0
- package/dist/src/gateway/headers.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +24 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/pae/config.interface.d.ts +15 -0
- package/dist/src/pae/config.interface.d.ts.map +1 -0
- package/dist/src/pae/config.interface.js +3 -0
- package/dist/src/pae/config.interface.js.map +1 -0
- package/dist/src/pae/index.d.ts +2 -0
- package/dist/src/pae/index.d.ts.map +1 -0
- package/dist/src/pae/index.js +18 -0
- package/dist/src/pae/index.js.map +1 -0
- package/dist/src/pae/pae.d.ts +17 -0
- package/dist/src/pae/pae.d.ts.map +1 -0
- package/dist/src/pae/pae.js +110 -0
- package/dist/src/pae/pae.js.map +1 -0
- package/dist/src/user/group.interface.d.ts +2 -0
- package/dist/src/user/group.interface.d.ts.map +1 -0
- package/dist/src/user/group.interface.js +3 -0
- package/dist/src/user/group.interface.js.map +1 -0
- package/dist/src/user/repositories/http.repository.d.ts +8 -0
- package/dist/src/user/repositories/http.repository.d.ts.map +1 -0
- package/dist/src/user/repositories/http.repository.js +39 -0
- package/dist/src/user/repositories/http.repository.js.map +1 -0
- package/dist/src/user/repositories/index.d.ts +2 -0
- package/dist/src/user/repositories/index.d.ts.map +1 -0
- package/dist/src/user/repositories/index.js +18 -0
- package/dist/src/user/repositories/index.js.map +1 -0
- package/dist/src/user/user-repository.interface.d.ts +5 -0
- package/dist/src/user/user-repository.interface.d.ts.map +1 -0
- package/dist/src/user/user-repository.interface.js +3 -0
- package/dist/src/user/user-repository.interface.js.map +1 -0
- package/dist/src/user/user.service.d.ts +7 -0
- package/dist/src/user/user.service.d.ts.map +1 -0
- package/dist/src/user/user.service.js +25 -0
- package/dist/src/user/user.service.js.map +1 -0
- package/dist/src/utilities.d.ts +3 -0
- package/dist/src/utilities.d.ts.map +1 -0
- package/dist/src/utilities.js +19 -0
- package/dist/src/utilities.js.map +1 -0
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"auth-user.interface.js","sourceRoot":"","sources":["../../../src/authentication/auth-user.interface.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"allowed-resources.interface.js","sourceRoot":"","sources":["../../../src/authorization/allowed-resources.interface.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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,w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MAAM,gBAAgB,GAAG,gBAAgB,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACpG,IAAI,gBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC;wBAC5B,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,gBAAgB,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 @@
|
|
|
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 @@
|
|
|
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"}
|