@pristine-ts/security 0.0.276 → 0.0.278
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/dist/lib/cjs/decorators/authenticator.decorator.js +4 -29
- package/dist/lib/cjs/decorators/authenticator.decorator.js.map +1 -1
- package/dist/lib/cjs/decorators/guard.decorator.js +8 -35
- package/dist/lib/cjs/decorators/guard.decorator.js.map +1 -1
- package/dist/lib/cjs/managers/authentication.manager.js +4 -2
- package/dist/lib/cjs/managers/authentication.manager.js.map +1 -1
- package/dist/lib/cjs/managers/authorizer.manager.js +4 -2
- package/dist/lib/cjs/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/esm/decorators/authenticator.decorator.js +3 -28
- package/dist/lib/esm/decorators/authenticator.decorator.js.map +1 -1
- package/dist/lib/esm/decorators/guard.decorator.js +7 -34
- package/dist/lib/esm/decorators/guard.decorator.js.map +1 -1
- package/dist/lib/esm/managers/authentication.manager.js +4 -2
- package/dist/lib/esm/managers/authentication.manager.js.map +1 -1
- package/dist/lib/esm/managers/authorizer.manager.js +4 -2
- package/dist/lib/esm/managers/authorizer.manager.js.map +1 -1
- package/dist/types/decorators/authenticator.decorator.d.ts +1 -0
- package/dist/types/decorators/guard.decorator.d.ts +1 -0
- package/package.json +4 -4
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authenticator = void 0;
|
|
3
|
+
exports.authenticator = exports.authenticatorMetadataKeyname = void 0;
|
|
4
4
|
const authenticator_decorator_error_1 = require("../errors/authenticator-decorator.error");
|
|
5
|
+
const common_1 = require("@pristine-ts/common");
|
|
6
|
+
exports.authenticatorMetadataKeyname = "@authenticator";
|
|
5
7
|
/**
|
|
6
8
|
* This decorator specifies the authenticator that should be used to authenticate a request.
|
|
7
9
|
* It should be used either on a controller class or directly on a method.
|
|
@@ -21,34 +23,7 @@ const authenticator = (authenticator, options) => {
|
|
|
21
23
|
authenticator,
|
|
22
24
|
options,
|
|
23
25
|
};
|
|
24
|
-
|
|
25
|
-
if (descriptor && propertyKey) {
|
|
26
|
-
if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
|
|
27
|
-
target.constructor.prototype["__metadata__"] = {};
|
|
28
|
-
}
|
|
29
|
-
if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
|
|
30
|
-
target.constructor.prototype["__metadata__"]["methods"] = {};
|
|
31
|
-
}
|
|
32
|
-
if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
|
|
33
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
|
|
34
|
-
}
|
|
35
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("__routeContext__") === false) {
|
|
36
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"] = {};
|
|
37
|
-
}
|
|
38
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["authenticator"] = authenticatorContext;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
if (target.prototype.hasOwnProperty("__metadata__") === false) {
|
|
42
|
-
target.prototype["__metadata__"] = {};
|
|
43
|
-
}
|
|
44
|
-
if (target.prototype["__metadata__"].hasOwnProperty("controller") === false) {
|
|
45
|
-
target.prototype["__metadata__"]["controller"] = {};
|
|
46
|
-
}
|
|
47
|
-
if (target.prototype["__metadata__"]["controller"].hasOwnProperty("__routeContext__") === false) {
|
|
48
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"] = {};
|
|
49
|
-
}
|
|
50
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"]["authenticator"] = authenticatorContext;
|
|
51
|
-
}
|
|
26
|
+
common_1.MetadataUtil.setToRouteContext(exports.authenticatorMetadataKeyname, authenticatorContext, target, propertyKey);
|
|
52
27
|
};
|
|
53
28
|
};
|
|
54
29
|
exports.authenticator = authenticator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/authenticator.decorator.ts"],"names":[],"mappings":";;;AAEA,2FAAoF;
|
|
1
|
+
{"version":3,"file":"authenticator.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/authenticator.decorator.ts"],"names":[],"mappings":";;;AAEA,2FAAoF;AACpF,gDAAiD;AAEpC,QAAA,4BAA4B,GAAG,gBAAgB,CAAC;AAE7D;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAC,aAAgD,EAAE,OAAa,EAAE,EAAE;IAC7F,OAAO,CAAE,MAAW,EACX,WAAoB,EACpB,UAA+B,EAAE,EAAE;QAGxC,kEAAkE;QAClE,IAAG,CAAC,CAAC,aAAa,IAAI,CAClB,CAAC,OAAO,aAAa,KAAK,UAAU,IAAI,OAAO,aAAa,CAAC,SAAS,CAAC,YAAY,KAAK,UAAU,IAAI,OAAO,aAAa,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;YAC/J,CAAC,OAAO,aAAa,KAAK,QAAQ,IAAI,OAAO,aAAa,CAAC,YAAY,KAAK,UAAU,IAAI,OAAO,aAAa,CAAC,UAAU,KAAK,UAAU,CAAC,CAC5I,CAAC,EAAE;YACA,MAAM,IAAI,2DAA2B,CAAC,+HAA+H,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;SACnO;QAED,+BAA+B;QAC/B,MAAM,oBAAoB,GAAmC;YACzD,eAAe,EAAG,aAAqB,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI;YAClE,aAAa;YACb,OAAO;SACV,CAAC;QAEF,qBAAY,CAAC,iBAAiB,CAAC,oCAA4B,EAAE,oBAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC5G,CAAC,CAAA;AACL,CAAC,CAAA;AAvBY,QAAA,aAAa,iBAuBzB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guard = void 0;
|
|
3
|
+
exports.guard = exports.guardMetadataKeyname = void 0;
|
|
4
4
|
const guard_decorator_error_1 = require("../errors/guard-decorator.error");
|
|
5
|
+
const common_1 = require("@pristine-ts/common");
|
|
6
|
+
exports.guardMetadataKeyname = "@guard";
|
|
5
7
|
/**
|
|
6
8
|
* This decorator specifies the guard that should be used to authorize a request.
|
|
7
9
|
* It should be used either on a controller class or directly on a method.
|
|
@@ -10,6 +12,7 @@ const guard_decorator_error_1 = require("../errors/guard-decorator.error");
|
|
|
10
12
|
*/
|
|
11
13
|
const guard = (guard, options) => {
|
|
12
14
|
return (target, propertyKey, descriptor) => {
|
|
15
|
+
var _a;
|
|
13
16
|
// Validate the interface of the guard
|
|
14
17
|
if (!(guard && ((typeof guard === 'function' && typeof guard.prototype.isAuthorized === 'function') ||
|
|
15
18
|
(typeof guard === 'object' && typeof guard.isAuthorized === 'function')))) {
|
|
@@ -21,40 +24,10 @@ const guard = (guard, options) => {
|
|
|
21
24
|
guard,
|
|
22
25
|
options,
|
|
23
26
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
|
|
30
|
-
target.constructor.prototype["__metadata__"]["methods"] = {};
|
|
31
|
-
}
|
|
32
|
-
if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
|
|
33
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
|
|
34
|
-
}
|
|
35
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("__routeContext__") === false) {
|
|
36
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"] = {};
|
|
37
|
-
}
|
|
38
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"].hasOwnProperty("guards") === false) {
|
|
39
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["guards"] = [];
|
|
40
|
-
}
|
|
41
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["guards"].push(guardContext);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
if (target.prototype.hasOwnProperty("__metadata__") === false) {
|
|
45
|
-
target.prototype["__metadata__"] = {};
|
|
46
|
-
}
|
|
47
|
-
if (target.prototype["__metadata__"].hasOwnProperty("controller") === false) {
|
|
48
|
-
target.prototype["__metadata__"]["controller"] = {};
|
|
49
|
-
}
|
|
50
|
-
if (target.prototype["__metadata__"]["controller"].hasOwnProperty("__routeContext__") === false) {
|
|
51
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"] = {};
|
|
52
|
-
}
|
|
53
|
-
if (target.prototype["__metadata__"]["controller"]["__routeContext__"].hasOwnProperty("guards") === false) {
|
|
54
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"]["guards"] = [];
|
|
55
|
-
}
|
|
56
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"]["guards"].push(guardContext);
|
|
57
|
-
}
|
|
27
|
+
const routeContext = common_1.MetadataUtil.getRouteContext(target, propertyKey);
|
|
28
|
+
const guards = (_a = routeContext[exports.guardMetadataKeyname]) !== null && _a !== void 0 ? _a : [];
|
|
29
|
+
guards.push(guardContext);
|
|
30
|
+
common_1.MetadataUtil.setToRouteContext(exports.guardMetadataKeyname, guards, target, propertyKey);
|
|
58
31
|
};
|
|
59
32
|
};
|
|
60
33
|
exports.guard = guard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/guard.decorator.ts"],"names":[],"mappings":";;;AACA,2EAAoE;
|
|
1
|
+
{"version":3,"file":"guard.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/guard.decorator.ts"],"names":[],"mappings":";;;AACA,2EAAoE;AAEpE,gDAAiD;AAEpC,QAAA,oBAAoB,GAAG,QAAQ,CAAC;AAE7C;;;;;GAKG;AACI,MAAM,KAAK,GAAG,CAAC,KAAgC,EAAE,OAAa,EAAE,EAAE;IACrE,OAAO,CAAE,MAAW,EACX,WAAoB,EACpB,UAA+B,EAAE,EAAE;;QAExC,sCAAsC;QACtC,IAAI,CAAC,CAAC,KAAK,IAAI,CACX,CAAC,OAAO,KAAK,KAAK,UAAU,IAAI,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,KAAK,UAAU,CAAC;YACnF,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,UAAU,CAAC,CAC1E,CAAC,EAAE;YACA,MAAM,IAAI,2CAAmB,CAAC,4FAA4F,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;SAChL;QAED,+BAA+B;QAC/B,MAAM,YAAY,GAA2B;YACzC,eAAe,EAAG,KAAa,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI;YAC1D,KAAK;YACL,OAAO;SACV,CAAC;QAGF,MAAM,YAAY,GAAG,qBAAY,CAAC,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,MAAA,YAAY,CAAC,4BAAoB,CAAC,mCAAI,EAAE,CAAC;QAExD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE1B,qBAAY,CAAC,iBAAiB,CAAC,4BAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACtF,CAAC,CAAA;AACL,CAAC,CAAA;AA7BY,QAAA,KAAK,SA6BjB"}
|
|
@@ -26,6 +26,7 @@ const tsyringe_1 = require("tsyringe");
|
|
|
26
26
|
const common_1 = require("@pristine-ts/common");
|
|
27
27
|
const authenticator_factory_1 = require("../factories/authenticator.factory");
|
|
28
28
|
const security_module_keyname_1 = require("../security.module.keyname");
|
|
29
|
+
const authenticator_decorator_1 = require("../decorators/authenticator.decorator");
|
|
29
30
|
/**
|
|
30
31
|
* The authentication manager provides authentication by returning the identity executing the action.
|
|
31
32
|
* It is tagged and can be injected using AuthenticationManagerInterface which facilitates mocking.
|
|
@@ -50,11 +51,12 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
50
51
|
*/
|
|
51
52
|
authenticate(request, routeContext, container) {
|
|
52
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
if (!routeContext || routeContext.
|
|
54
|
+
if (!routeContext || routeContext[authenticator_decorator_1.authenticatorMetadataKeyname] === undefined) {
|
|
54
55
|
return undefined;
|
|
55
56
|
}
|
|
57
|
+
const authenticator = routeContext[authenticator_decorator_1.authenticatorMetadataKeyname];
|
|
56
58
|
let identity;
|
|
57
|
-
const authenticatorContext =
|
|
59
|
+
const authenticatorContext = authenticator;
|
|
58
60
|
try {
|
|
59
61
|
const instantiatedAuthenticator = this.authenticatorFactory.fromContext(authenticatorContext, container);
|
|
60
62
|
yield instantiatedAuthenticator.setContext(authenticatorContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/managers/authentication.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4E;AAE5E,gDAAmG;AAInG,8EAAwE;AACxE,wEAAiE;
|
|
1
|
+
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/managers/authentication.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4E;AAE5E,gDAAmG;AAInG,8EAAwE;AACxE,wEAAiE;AAGjE,mFAAmF;AAEnF;;;GAGG;AAII,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAE9B;;;;;OAKG;IACH,YAC2E,iBAA8C,EACrE,UAA+B,EAC/C,oBAA0C;QAFH,sBAAiB,GAAjB,iBAAiB,CA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IAAA,oBAAS,EAAC,iCAAwB,CAAC,gBAAgB,CAAC,CAAA;IACpD,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;oDACwB,4CAAoB;GAXrE,qBAAqB,CAsDjC"}
|
|
@@ -26,6 +26,7 @@ const tsyringe_1 = require("tsyringe");
|
|
|
26
26
|
const common_1 = require("@pristine-ts/common");
|
|
27
27
|
const guard_factory_1 = require("../factories/guard.factory");
|
|
28
28
|
const security_module_keyname_1 = require("../security.module.keyname");
|
|
29
|
+
const guard_decorator_1 = require("../decorators/guard.decorator");
|
|
29
30
|
/**
|
|
30
31
|
* The authorizer manager provides authorization by authorizing the action.
|
|
31
32
|
* It is tagged and can be injected using AuthorizerManagerInterface which facilitates mocking.
|
|
@@ -50,11 +51,12 @@ let AuthorizerManager = class AuthorizerManager {
|
|
|
50
51
|
isAuthorized(request, routeContext, container, identity) {
|
|
51
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
53
|
// If there are no guards defined, we simply return that it is authorized.
|
|
53
|
-
if (!routeContext || routeContext.
|
|
54
|
+
if (!routeContext || routeContext[guard_decorator_1.guardMetadataKeyname] === undefined || Array.isArray(routeContext[guard_decorator_1.guardMetadataKeyname]) === false) {
|
|
54
55
|
return true;
|
|
55
56
|
}
|
|
57
|
+
const guards = routeContext[guard_decorator_1.guardMetadataKeyname];
|
|
56
58
|
let isAuthorized = true;
|
|
57
|
-
for (const guardContext of
|
|
59
|
+
for (const guardContext of guards) {
|
|
58
60
|
try {
|
|
59
61
|
const instantiatedGuard = this.guardFactory.fromContext(guardContext, container);
|
|
60
62
|
yield instantiatedGuard.setContext(guardContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizer.manager.js","sourceRoot":"","sources":["../../../../src/managers/authorizer.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAiE;AAEjE,gDAAyE;AAEzE,8DAAwD;AACxD,wEAAiE;
|
|
1
|
+
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B;aACJ;YAED,OAAO,YAAY,CAAC;QACxB,CAAC;KAAA;CACJ,CAAA;AA9CY,8CAAiB;4BAAjB,iBAAiB;IAH7B,IAAA,qBAAY,EAAC,+CAAqB,CAAC;IACnC,IAAA,YAAG,EAAC,4BAA4B,CAAC;IACjC,IAAA,qBAAU,GAAE;IAQW,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;6CACC,4BAAY;GARrD,iBAAiB,CA8C7B"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AuthenticatorDecoratorError } from "../errors/authenticator-decorator.error";
|
|
2
|
+
import { MetadataUtil } from "@pristine-ts/common";
|
|
3
|
+
export const authenticatorMetadataKeyname = "@authenticator";
|
|
2
4
|
/**
|
|
3
5
|
* This decorator specifies the authenticator that should be used to authenticate a request.
|
|
4
6
|
* It should be used either on a controller class or directly on a method.
|
|
@@ -18,34 +20,7 @@ export const authenticator = (authenticator, options) => {
|
|
|
18
20
|
authenticator,
|
|
19
21
|
options,
|
|
20
22
|
};
|
|
21
|
-
|
|
22
|
-
if (descriptor && propertyKey) {
|
|
23
|
-
if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
|
|
24
|
-
target.constructor.prototype["__metadata__"] = {};
|
|
25
|
-
}
|
|
26
|
-
if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
|
|
27
|
-
target.constructor.prototype["__metadata__"]["methods"] = {};
|
|
28
|
-
}
|
|
29
|
-
if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
|
|
30
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
|
|
31
|
-
}
|
|
32
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("__routeContext__") === false) {
|
|
33
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"] = {};
|
|
34
|
-
}
|
|
35
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["authenticator"] = authenticatorContext;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
if (target.prototype.hasOwnProperty("__metadata__") === false) {
|
|
39
|
-
target.prototype["__metadata__"] = {};
|
|
40
|
-
}
|
|
41
|
-
if (target.prototype["__metadata__"].hasOwnProperty("controller") === false) {
|
|
42
|
-
target.prototype["__metadata__"]["controller"] = {};
|
|
43
|
-
}
|
|
44
|
-
if (target.prototype["__metadata__"]["controller"].hasOwnProperty("__routeContext__") === false) {
|
|
45
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"] = {};
|
|
46
|
-
}
|
|
47
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"]["authenticator"] = authenticatorContext;
|
|
48
|
-
}
|
|
23
|
+
MetadataUtil.setToRouteContext(authenticatorMetadataKeyname, authenticatorContext, target, propertyKey);
|
|
49
24
|
};
|
|
50
25
|
};
|
|
51
26
|
//# sourceMappingURL=authenticator.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/authenticator.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,2BAA2B,EAAC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"authenticator.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/authenticator.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,2BAA2B,EAAC,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,aAAgD,EAAE,OAAa,EAAE,EAAE;IAC7F,OAAO,CAAE,MAAW,EACX,WAAoB,EACpB,UAA+B,EAAE,EAAE;QAGxC,kEAAkE;QAClE,IAAG,CAAC,CAAC,aAAa,IAAI,CAClB,CAAC,OAAO,aAAa,KAAK,UAAU,IAAI,OAAO,aAAa,CAAC,SAAS,CAAC,YAAY,KAAK,UAAU,IAAI,OAAO,aAAa,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;YAC/J,CAAC,OAAO,aAAa,KAAK,QAAQ,IAAI,OAAO,aAAa,CAAC,YAAY,KAAK,UAAU,IAAI,OAAO,aAAa,CAAC,UAAU,KAAK,UAAU,CAAC,CAC5I,CAAC,EAAE;YACA,MAAM,IAAI,2BAA2B,CAAC,+HAA+H,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;SACnO;QAED,+BAA+B;QAC/B,MAAM,oBAAoB,GAAmC;YACzD,eAAe,EAAG,aAAqB,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI;YAClE,aAAa;YACb,OAAO;SACV,CAAC;QAEF,YAAY,CAAC,iBAAiB,CAAC,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC5G,CAAC,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GuardDecoratorError } from "../errors/guard-decorator.error";
|
|
2
|
+
import { MetadataUtil } from "@pristine-ts/common";
|
|
3
|
+
export const guardMetadataKeyname = "@guard";
|
|
2
4
|
/**
|
|
3
5
|
* This decorator specifies the guard that should be used to authorize a request.
|
|
4
6
|
* It should be used either on a controller class or directly on a method.
|
|
@@ -7,6 +9,7 @@ import { GuardDecoratorError } from "../errors/guard-decorator.error";
|
|
|
7
9
|
*/
|
|
8
10
|
export const guard = (guard, options) => {
|
|
9
11
|
return (target, propertyKey, descriptor) => {
|
|
12
|
+
var _a;
|
|
10
13
|
// Validate the interface of the guard
|
|
11
14
|
if (!(guard && ((typeof guard === 'function' && typeof guard.prototype.isAuthorized === 'function') ||
|
|
12
15
|
(typeof guard === 'object' && typeof guard.isAuthorized === 'function')))) {
|
|
@@ -18,40 +21,10 @@ export const guard = (guard, options) => {
|
|
|
18
21
|
guard,
|
|
19
22
|
options,
|
|
20
23
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
|
|
27
|
-
target.constructor.prototype["__metadata__"]["methods"] = {};
|
|
28
|
-
}
|
|
29
|
-
if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
|
|
30
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
|
|
31
|
-
}
|
|
32
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("__routeContext__") === false) {
|
|
33
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"] = {};
|
|
34
|
-
}
|
|
35
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"].hasOwnProperty("guards") === false) {
|
|
36
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["guards"] = [];
|
|
37
|
-
}
|
|
38
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["guards"].push(guardContext);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
if (target.prototype.hasOwnProperty("__metadata__") === false) {
|
|
42
|
-
target.prototype["__metadata__"] = {};
|
|
43
|
-
}
|
|
44
|
-
if (target.prototype["__metadata__"].hasOwnProperty("controller") === false) {
|
|
45
|
-
target.prototype["__metadata__"]["controller"] = {};
|
|
46
|
-
}
|
|
47
|
-
if (target.prototype["__metadata__"]["controller"].hasOwnProperty("__routeContext__") === false) {
|
|
48
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"] = {};
|
|
49
|
-
}
|
|
50
|
-
if (target.prototype["__metadata__"]["controller"]["__routeContext__"].hasOwnProperty("guards") === false) {
|
|
51
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"]["guards"] = [];
|
|
52
|
-
}
|
|
53
|
-
target.prototype["__metadata__"]["controller"]["__routeContext__"]["guards"].push(guardContext);
|
|
54
|
-
}
|
|
24
|
+
const routeContext = MetadataUtil.getRouteContext(target, propertyKey);
|
|
25
|
+
const guards = (_a = routeContext[guardMetadataKeyname]) !== null && _a !== void 0 ? _a : [];
|
|
26
|
+
guards.push(guardContext);
|
|
27
|
+
MetadataUtil.setToRouteContext(guardMetadataKeyname, guards, target, propertyKey);
|
|
55
28
|
};
|
|
56
29
|
};
|
|
57
30
|
//# sourceMappingURL=guard.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/guard.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"guard.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/guard.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAgC,EAAE,OAAa,EAAE,EAAE;IACrE,OAAO,CAAE,MAAW,EACX,WAAoB,EACpB,UAA+B,EAAE,EAAE;;QAExC,sCAAsC;QACtC,IAAI,CAAC,CAAC,KAAK,IAAI,CACX,CAAC,OAAO,KAAK,KAAK,UAAU,IAAI,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,KAAK,UAAU,CAAC;YACnF,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,UAAU,CAAC,CAC1E,CAAC,EAAE;YACA,MAAM,IAAI,mBAAmB,CAAC,4FAA4F,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;SAChL;QAED,+BAA+B;QAC/B,MAAM,YAAY,GAA2B;YACzC,eAAe,EAAG,KAAa,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI;YAC1D,KAAK;YACL,OAAO;SACV,CAAC;QAGF,MAAM,YAAY,GAAG,YAAY,CAAC,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,MAAA,YAAY,CAAC,oBAAoB,CAAC,mCAAI,EAAE,CAAC;QAExD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE1B,YAAY,CAAC,iBAAiB,CAAC,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACtF,CAAC,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -23,6 +23,7 @@ import { inject, injectable, injectAll } from "tsyringe";
|
|
|
23
23
|
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
24
24
|
import { AuthenticatorFactory } from "../factories/authenticator.factory";
|
|
25
25
|
import { SecurityModuleKeyname } from "../security.module.keyname";
|
|
26
|
+
import { authenticatorMetadataKeyname } from "../decorators/authenticator.decorator";
|
|
26
27
|
/**
|
|
27
28
|
* The authentication manager provides authentication by returning the identity executing the action.
|
|
28
29
|
* It is tagged and can be injected using AuthenticationManagerInterface which facilitates mocking.
|
|
@@ -47,11 +48,12 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
47
48
|
*/
|
|
48
49
|
authenticate(request, routeContext, container) {
|
|
49
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
if (!routeContext || routeContext
|
|
51
|
+
if (!routeContext || routeContext[authenticatorMetadataKeyname] === undefined) {
|
|
51
52
|
return undefined;
|
|
52
53
|
}
|
|
54
|
+
const authenticator = routeContext[authenticatorMetadataKeyname];
|
|
53
55
|
let identity;
|
|
54
|
-
const authenticatorContext =
|
|
56
|
+
const authenticatorContext = authenticator;
|
|
55
57
|
try {
|
|
56
58
|
const instantiatedAuthenticator = this.authenticatorFactory.fromContext(authenticatorContext, container);
|
|
57
59
|
yield instantiatedAuthenticator.setContext(authenticatorContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/managers/authentication.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAInG,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/managers/authentication.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAInG,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AAEnF;;;GAGG;AAII,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAE9B;;;;;OAKG;IACH,YAC2E,iBAA8C,EACrE,UAA+B,EAC/C,oBAA0C;QAFH,sBAAiB,GAAjB,iBAAiB,CAA6B;QACrE,eAAU,GAAV,UAAU,CAAqB;QAC/C,yBAAoB,GAApB,oBAAoB,CAAsB;IAC9E,CAAC;IAED;;;;;OAKG;IACU,YAAY,CAAC,OAAgB,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, injectable } from "tsyringe";
|
|
|
23
23
|
import { moduleScoped, tag } from "@pristine-ts/common";
|
|
24
24
|
import { GuardFactory } from "../factories/guard.factory";
|
|
25
25
|
import { SecurityModuleKeyname } from "../security.module.keyname";
|
|
26
|
+
import { guardMetadataKeyname } from "../decorators/guard.decorator";
|
|
26
27
|
/**
|
|
27
28
|
* The authorizer manager provides authorization by authorizing the action.
|
|
28
29
|
* It is tagged and can be injected using AuthorizerManagerInterface which facilitates mocking.
|
|
@@ -47,11 +48,12 @@ let AuthorizerManager = class AuthorizerManager {
|
|
|
47
48
|
isAuthorized(request, routeContext, container, identity) {
|
|
48
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
50
|
// If there are no guards defined, we simply return that it is authorized.
|
|
50
|
-
if (!routeContext || routeContext
|
|
51
|
+
if (!routeContext || routeContext[guardMetadataKeyname] === undefined || Array.isArray(routeContext[guardMetadataKeyname]) === false) {
|
|
51
52
|
return true;
|
|
52
53
|
}
|
|
54
|
+
const guards = routeContext[guardMetadataKeyname];
|
|
53
55
|
let isAuthorized = true;
|
|
54
|
-
for (const guardContext of
|
|
56
|
+
for (const guardContext of guards) {
|
|
55
57
|
try {
|
|
56
58
|
const instantiatedGuard = this.guardFactory.fromContext(guardContext, container);
|
|
57
59
|
yield instantiatedGuard.setContext(guardContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizer.manager.js","sourceRoot":"","sources":["../../../../src/managers/authorizer.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAEjE,OAAO,EAAoB,YAAY,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"authorizer.manager.js","sourceRoot":"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AAI,YAAY,CAAC;iBAC/C;gBACD,OAAO,CAAC,EAAE;oBACN,IAAI,CAAC,UAAU,CAAC,KAAK,CAAE,CAAW,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;oBACnE,YAAY,GAAG,KAAK,CAAC;iBACxB;aACJ;YAED,OAAO,YAAY,CAAC;QACxB,CAAC;KAAA;CACJ,CAAA;AA9CY,iBAAiB;IAH7B,YAAY,CAAC,qBAAqB,CAAC;IACnC,GAAG,CAAC,4BAA4B,CAAC;IACjC,UAAU,EAAE;IAQW,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;6CACC,YAAY;GARrD,iBAAiB,CA8C7B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AuthenticatorInterface } from "../interfaces/authenticator.interface";
|
|
2
|
+
export declare const authenticatorMetadataKeyname = "@authenticator";
|
|
2
3
|
/**
|
|
3
4
|
* This decorator specifies the authenticator that should be used to authenticate a request.
|
|
4
5
|
* It should be used either on a controller class or directly on a method.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GuardInterface } from "../interfaces/guard.interface";
|
|
2
|
+
export declare const guardMetadataKeyname = "@guard";
|
|
2
3
|
/**
|
|
3
4
|
* This decorator specifies the guard that should be used to authorize a request.
|
|
4
5
|
* It should be used either on a controller class or directly on a method.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/security",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.278",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/security.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/security.module.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pristine-ts/common": "^0.0.
|
|
24
|
-
"@pristine-ts/logging": "^0.0.
|
|
23
|
+
"@pristine-ts/common": "^0.0.278",
|
|
24
|
+
"@pristine-ts/logging": "^0.0.278"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/jsonwebtoken": "^8.5.1"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"src/*.{js,ts}"
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "919af75933ff21c315d4e2d0aa6f5a2be98b6752"
|
|
64
64
|
}
|