@pristine-ts/security 2.0.3 → 2.0.5
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/errors/authenticator-decorator.error.js +9 -13
- package/dist/lib/cjs/errors/authenticator-decorator.error.js.map +1 -1
- package/dist/lib/cjs/errors/authenticator-instantiation.error.js +5 -9
- package/dist/lib/cjs/errors/authenticator-instantiation.error.js.map +1 -1
- package/dist/lib/cjs/errors/guard-decorator.error.js +9 -13
- package/dist/lib/cjs/errors/guard-decorator.error.js.map +1 -1
- package/dist/lib/cjs/errors/guard-instantiation.error.js +5 -9
- package/dist/lib/cjs/errors/guard-instantiation.error.js.map +1 -1
- package/dist/lib/cjs/factories/authenticator.factory.js +5 -2
- package/dist/lib/cjs/factories/authenticator.factory.js.map +1 -1
- package/dist/lib/cjs/factories/guard.factory.js +6 -2
- package/dist/lib/cjs/factories/guard.factory.js.map +1 -1
- package/dist/lib/cjs/guards/role.guard.js +6 -0
- package/dist/lib/cjs/guards/role.guard.js.map +1 -1
- package/dist/lib/cjs/managers/authentication.manager.js +8 -9
- package/dist/lib/cjs/managers/authentication.manager.js.map +1 -1
- package/dist/lib/cjs/managers/authorizer.manager.js +12 -24
- package/dist/lib/cjs/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/esm/errors/authenticator-decorator.error.js +10 -14
- package/dist/lib/esm/errors/authenticator-decorator.error.js.map +1 -1
- package/dist/lib/esm/errors/authenticator-instantiation.error.js +6 -10
- package/dist/lib/esm/errors/authenticator-instantiation.error.js.map +1 -1
- package/dist/lib/esm/errors/guard-decorator.error.js +10 -14
- package/dist/lib/esm/errors/guard-decorator.error.js.map +1 -1
- package/dist/lib/esm/errors/guard-instantiation.error.js +6 -10
- package/dist/lib/esm/errors/guard-instantiation.error.js.map +1 -1
- package/dist/lib/esm/factories/authenticator.factory.js +5 -2
- package/dist/lib/esm/factories/authenticator.factory.js.map +1 -1
- package/dist/lib/esm/factories/guard.factory.js +6 -2
- package/dist/lib/esm/factories/guard.factory.js.map +1 -1
- package/dist/lib/esm/guards/role.guard.js +7 -1
- package/dist/lib/esm/guards/role.guard.js.map +1 -1
- package/dist/lib/esm/managers/authentication.manager.js +9 -10
- package/dist/lib/esm/managers/authentication.manager.js.map +1 -1
- package/dist/lib/esm/managers/authorizer.manager.js +13 -25
- package/dist/lib/esm/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/errors/authenticator-decorator.error.d.ts +2 -2
- package/dist/types/errors/authenticator-instantiation.error.d.ts +2 -2
- package/dist/types/errors/guard-decorator.error.d.ts +2 -2
- package/dist/types/errors/guard-instantiation.error.d.ts +2 -2
- package/dist/types/managers/authentication.manager.d.ts +2 -3
- package/dist/types/managers/authorizer.manager.d.ts +2 -4
- package/package.json +4 -4
|
@@ -5,20 +5,16 @@ const common_1 = require("@pristine-ts/common");
|
|
|
5
5
|
/**
|
|
6
6
|
* This Error is thrown when there's an error with the authenticator decorator.
|
|
7
7
|
*/
|
|
8
|
-
class AuthenticatorDecoratorError extends common_1.
|
|
8
|
+
class AuthenticatorDecoratorError extends common_1.PristineError {
|
|
9
9
|
constructor(message, authenticator, options, target, propertyKey, descriptor) {
|
|
10
|
-
super(message, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Set the prototype explicitly.
|
|
19
|
-
// As specified in the documentation in TypeScript
|
|
20
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
21
|
-
Object.setPrototypeOf(this, AuthenticatorDecoratorError.prototype);
|
|
10
|
+
super(message, { details: {
|
|
11
|
+
message,
|
|
12
|
+
authenticator,
|
|
13
|
+
options,
|
|
14
|
+
target,
|
|
15
|
+
propertyKey,
|
|
16
|
+
descriptor,
|
|
17
|
+
} });
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
exports.AuthenticatorDecoratorError = AuthenticatorDecoratorError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator-decorator.error.js","sourceRoot":"","sources":["../../../../src/errors/authenticator-decorator.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sBAAa;IAE5D,YAAmB,OAAe,EAAE,aAAgD,EAAE,OAAY,EAAE,MAAW,EAC5F,WAAoB,EACpB,UAA+B;QAChD,KAAK,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"authenticator-decorator.error.js","sourceRoot":"","sources":["../../../../src/errors/authenticator-decorator.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,2BAA4B,SAAQ,sBAAa;IAE5D,YAAmB,OAAe,EAAE,aAAgD,EAAE,OAAY,EAAE,MAAW,EAC5F,WAAoB,EACpB,UAA+B;QAChD,KAAK,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE;gBACvB,OAAO;gBACP,aAAa;gBACb,OAAO;gBACP,MAAM;gBACN,WAAW;gBACX,UAAU;aACX,EAAC,CAAC,CAAC;IAAE,CAAC;CACV;AAbD,kEAaC"}
|
|
@@ -5,16 +5,12 @@ const common_1 = require("@pristine-ts/common");
|
|
|
5
5
|
/**
|
|
6
6
|
* This Error is thrown when there's an error that happens when the authenticator are being initialized
|
|
7
7
|
*/
|
|
8
|
-
class AuthenticatorInstantiationError extends common_1.
|
|
8
|
+
class AuthenticatorInstantiationError extends common_1.PristineError {
|
|
9
9
|
constructor(message, instantiatedAuthenticator, authenticatorContext) {
|
|
10
|
-
super(message, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// Set the prototype explicitly.
|
|
15
|
-
// As specified in the documentation in TypeScript
|
|
16
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
17
|
-
Object.setPrototypeOf(this, AuthenticatorInstantiationError.prototype);
|
|
10
|
+
super(message, { details: {
|
|
11
|
+
instantiatedAuthenticator,
|
|
12
|
+
authenticatorContext,
|
|
13
|
+
} });
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
exports.AuthenticatorInstantiationError = AuthenticatorInstantiationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator-instantiation.error.js","sourceRoot":"","sources":["../../../../src/errors/authenticator-instantiation.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,+BAAgC,SAAQ,sBAAa;IAGhE,YAAmB,OAAe,EAAE,yBAA4D,EAAE,oBAAyB;QACzH,KAAK,CAAC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"authenticator-instantiation.error.js","sourceRoot":"","sources":["../../../../src/errors/authenticator-instantiation.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,+BAAgC,SAAQ,sBAAa;IAGhE,YAAmB,OAAe,EAAE,yBAA4D,EAAE,oBAAyB;QACzH,KAAK,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE;gBACvB,yBAAyB;gBACzB,oBAAoB;aACrB,EAAC,CAAC,CAAC;IAAE,CAAC;CACV;AARD,0EAQC"}
|
|
@@ -5,20 +5,16 @@ const common_1 = require("@pristine-ts/common");
|
|
|
5
5
|
/**
|
|
6
6
|
* This Error is thrown when there's an error that happens when the guards ere being initialized
|
|
7
7
|
*/
|
|
8
|
-
class GuardDecoratorError extends common_1.
|
|
8
|
+
class GuardDecoratorError extends common_1.PristineError {
|
|
9
9
|
constructor(message, guard, options, target, propertyKey, descriptor) {
|
|
10
|
-
super(message, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Set the prototype explicitly.
|
|
19
|
-
// As specified in the documentation in TypeScript
|
|
20
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
21
|
-
Object.setPrototypeOf(this, GuardDecoratorError.prototype);
|
|
10
|
+
super(message, { details: {
|
|
11
|
+
message,
|
|
12
|
+
guard,
|
|
13
|
+
options,
|
|
14
|
+
target,
|
|
15
|
+
propertyKey,
|
|
16
|
+
descriptor,
|
|
17
|
+
} });
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
exports.GuardDecoratorError = GuardDecoratorError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-decorator.error.js","sourceRoot":"","sources":["../../../../src/errors/guard-decorator.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,sBAAa;IAEpD,YAAmB,OAAe,EAAE,KAAgC,EAAE,OAAY,EAAE,MAAW,EAC5E,WAAoB,EACpB,UAA+B;QAChD,KAAK,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"guard-decorator.error.js","sourceRoot":"","sources":["../../../../src/errors/guard-decorator.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,sBAAa;IAEpD,YAAmB,OAAe,EAAE,KAAgC,EAAE,OAAY,EAAE,MAAW,EAC5E,WAAoB,EACpB,UAA+B;QAChD,KAAK,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE;gBACvB,OAAO;gBACP,KAAK;gBACL,OAAO;gBACP,MAAM;gBACN,WAAW;gBACX,UAAU;aACX,EAAC,CAAC,CAAC;IAAE,CAAC;CACV;AAbD,kDAaC"}
|
|
@@ -5,16 +5,12 @@ const common_1 = require("@pristine-ts/common");
|
|
|
5
5
|
/**
|
|
6
6
|
* This Error is thrown when there's an error that happens when the guards ere being initialized
|
|
7
7
|
*/
|
|
8
|
-
class GuardInstantiationError extends common_1.
|
|
8
|
+
class GuardInstantiationError extends common_1.PristineError {
|
|
9
9
|
constructor(message, instantiatedGuard, guardContext) {
|
|
10
|
-
super(message, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// Set the prototype explicitly.
|
|
15
|
-
// As specified in the documentation in TypeScript
|
|
16
|
-
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
17
|
-
Object.setPrototypeOf(this, GuardInstantiationError.prototype);
|
|
10
|
+
super(message, { details: {
|
|
11
|
+
instantiatedGuard,
|
|
12
|
+
guardContext,
|
|
13
|
+
} });
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
exports.GuardInstantiationError = GuardInstantiationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-instantiation.error.js","sourceRoot":"","sources":["../../../../src/errors/guard-instantiation.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,uBAAwB,SAAQ,sBAAa;IACxD,YAAmB,OAAe,EAAE,iBAA4C,EAAE,YAAiB;QACjG,KAAK,CAAC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"guard-instantiation.error.js","sourceRoot":"","sources":["../../../../src/errors/guard-instantiation.error.ts"],"names":[],"mappings":";;;AAAA,gDAAkD;AAGlD;;GAEG;AACH,MAAa,uBAAwB,SAAQ,sBAAa;IACxD,YAAmB,OAAe,EAAE,iBAA4C,EAAE,YAAiB;QACjG,KAAK,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE;gBACvB,iBAAiB;gBACjB,YAAY;aACb,EAAC,CAAC,CAAC;IAAE,CAAC;CACV;AAND,0DAMC"}
|
|
@@ -22,8 +22,11 @@ let AuthenticatorFactory = class AuthenticatorFactory {
|
|
|
22
22
|
fromContext(authenticatorContext, container) {
|
|
23
23
|
// Check if the guard needs to be instantiated
|
|
24
24
|
let instantiatedAuthenticator = authenticatorContext.authenticator;
|
|
25
|
-
//
|
|
26
|
-
//
|
|
25
|
+
// ── container.resolve, justified ────────────────────────────────────────────
|
|
26
|
+
// Per CLAUDE.md: factory whose target class is data carried on the route's
|
|
27
|
+
// `@authenticator(SomeAuth)` metadata. Token isn't known at factory construction;
|
|
28
|
+
// resolving it is the factory's entire purpose. Per-event container passed in by
|
|
29
|
+
// the router so the authenticator sees request-scoped dependencies.
|
|
27
30
|
if (typeof instantiatedAuthenticator === 'function') {
|
|
28
31
|
instantiatedAuthenticator = container.resolve(instantiatedAuthenticator);
|
|
29
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticator.factory.js","sourceRoot":"","sources":["../../../../src/factories/authenticator.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyD;AAGzD,mGAA4F;AAE5F;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAE/B;;;;;OAKG;IACH,WAAW,CAAC,oBAAmD,EAAE,SAA8B;QAC7F,8CAA8C;QAC9C,IAAI,yBAAyB,GAA2B,oBAAoB,CAAC,aAAuC,CAAC;QAErH,
|
|
1
|
+
{"version":3,"file":"authenticator.factory.js","sourceRoot":"","sources":["../../../../src/factories/authenticator.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyD;AAGzD,mGAA4F;AAE5F;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAE/B;;;;;OAKG;IACH,WAAW,CAAC,oBAAmD,EAAE,SAA8B;QAC7F,8CAA8C;QAC9C,IAAI,yBAAyB,GAA2B,oBAAoB,CAAC,aAAuC,CAAC;QAErH,+EAA+E;QAC/E,2EAA2E;QAC3E,kFAAkF;QAClF,iFAAiF;QACjF,oEAAoE;QACpE,IAAI,OAAO,yBAAyB,KAAK,UAAU,EAAE,CAAC;YACpD,yBAAyB,GAAG,SAAS,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC3E,CAAC;QAED,uDAAuD;QACvD,IAAI,OAAO,yBAAyB,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YACjE,MAAM,IAAI,mEAA+B,CAAC,oGAAoG,EAAE,yBAAyB,EAAE,oBAAoB,CAAC,CAAC;QACnM,CAAC;QAED,qDAAqD;QACrD,IAAI,OAAO,yBAAyB,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;YAC/D,MAAM,IAAI,mEAA+B,CAAC,kGAAkG,EAAE,yBAAyB,EAAE,oBAAoB,CAAC,CAAC;QACjM,CAAC;QAED,OAAO,yBAAyB,CAAC;IACnC,CAAC;CACF,CAAA;AAjCY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;GACA,oBAAoB,CAiChC"}
|
|
@@ -22,8 +22,12 @@ let GuardFactory = class GuardFactory {
|
|
|
22
22
|
fromContext(guardContext, container) {
|
|
23
23
|
// Check if the guard needs to be instantiated
|
|
24
24
|
let instantiatedGuard = guardContext.guard;
|
|
25
|
-
//
|
|
26
|
-
//
|
|
25
|
+
// ── container.resolve, justified ────────────────────────────────────────────
|
|
26
|
+
// Per CLAUDE.md: this is a factory whose target class is data carried on the
|
|
27
|
+
// route's metadata (the `@guard(SomeGuard)` decorator value). The token isn't
|
|
28
|
+
// known at factory construction; the factory's whole job is to look it up. The
|
|
29
|
+
// per-event child container is passed in by the router so the resolved guard
|
|
30
|
+
// sees the correct request-scoped dependencies.
|
|
27
31
|
if (typeof instantiatedGuard === 'function') {
|
|
28
32
|
instantiatedGuard = container.resolve(instantiatedGuard);
|
|
29
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.factory.js","sourceRoot":"","sources":["../../../../src/factories/guard.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyD;AAGzD,mFAA4E;AAE5E;;GAEG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEvB;;;;;OAKG;IACH,WAAW,CAAC,YAAmC,EAAE,SAA8B;QAC7E,8CAA8C;QAC9C,IAAI,iBAAiB,GAAmB,YAAY,CAAC,KAAuB,CAAC;QAE7E,
|
|
1
|
+
{"version":3,"file":"guard.factory.js","sourceRoot":"","sources":["../../../../src/factories/guard.factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyD;AAGzD,mFAA4E;AAE5E;;GAEG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEvB;;;;;OAKG;IACH,WAAW,CAAC,YAAmC,EAAE,SAA8B;QAC7E,8CAA8C;QAC9C,IAAI,iBAAiB,GAAmB,YAAY,CAAC,KAAuB,CAAC;QAE7E,+EAA+E;QAC/E,6EAA6E;QAC7E,8EAA8E;QAC9E,+EAA+E;QAC/E,6EAA6E;QAC7E,gDAAgD;QAChD,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,iBAAiB,GAAG,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC;QAED,uDAAuD;QACvD,IAAI,OAAO,iBAAiB,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YACzD,MAAM,IAAI,mDAAuB,CAAC,wDAAwD,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;QAC/H,CAAC;QAED,qDAAqD;QACrD,IAAI,OAAO,iBAAiB,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;YACvD,MAAM,IAAI,mDAAuB,CAAC,sDAAsD,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;QAC7H,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF,CAAA;AAlCY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,qBAAU,GAAE;GACA,YAAY,CAkCxB"}
|
|
@@ -102,6 +102,12 @@ let RoleGuard = class RoleGuard {
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
exports.RoleGuard = RoleGuard;
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, common_1.traced)(),
|
|
107
|
+
__metadata("design:type", Function),
|
|
108
|
+
__metadata("design:paramtypes", [common_1.Request, Object]),
|
|
109
|
+
__metadata("design:returntype", Promise)
|
|
110
|
+
], RoleGuard.prototype, "isAuthorized", null);
|
|
105
111
|
exports.RoleGuard = RoleGuard = __decorate([
|
|
106
112
|
(0, tsyringe_1.injectable)(),
|
|
107
113
|
__param(0, (0, common_1.injectConfig)(security_configuration_keys_1.SecurityConfigurationKeys.RolesClaimKey)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../../src/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAC5C,gFAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../../src/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAC5C,gFAAyE;AACzE,gDAAqF;AAKrF;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAS;IAWpB;;;OAGG;IACH,YAAmE,aAAsC,EAC9D,UAAgD;QADP,kBAAa,GAAb,aAAa,CAAQ;QAC7C,eAAU,GAAV,UAAU,CAAqB;QAf3F;;WAEG;QACI,YAAO,GAAG,MAAM,CAAC;IAaxB,CAAC;IAED;;;OAGG;IACG,UAAU,CAAC,OAAY;;YAC3B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAE5B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,2CAA2C,EAAE,EAAC,KAAK,EAAE,EAAC,OAAO,EAAC,EAAC,CAAC,CAAC;YAEvF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KAAA;IAED;;;;;;OAMG;IAEG,YAAY,CAAC,OAAgB,EAAE,QAA4B;;;YAC/D,MAAM,WAAW,GAAa,EAAE,CAAC;YAEjC,iCAAiC;YACjC,I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ACL;qBACF,CAAC,CAAC;oBACH,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;YAED,4DAA4D;YAC5D,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF,CAAA;AAlFY,8BAAS;AAuCd;IADL,IAAA,eAAM,GAAE;;qCACmB,gBAAO;;6CA0ClC;oBAjFU,SAAS;IADrB,IAAA,qBAAU,GAAE;IAgBE,WAAA,IAAA,qBAAY,EAAC,uDAAyB,CAAC,aAAa,CAAC,CAAA;IACrD,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;;GAhB/B,SAAS,CAkFrB"}
|
|
@@ -38,11 +38,10 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
38
38
|
* @param logHandler The log handler to output logs.
|
|
39
39
|
* @param authenticatorFactory The factory to create the authenticator.
|
|
40
40
|
*/
|
|
41
|
-
constructor(identityProviders, logHandler, authenticatorFactory
|
|
41
|
+
constructor(identityProviders, logHandler, authenticatorFactory) {
|
|
42
42
|
this.identityProviders = identityProviders;
|
|
43
43
|
this.logHandler = logHandler;
|
|
44
44
|
this.authenticatorFactory = authenticatorFactory;
|
|
45
|
-
this.breadcrumbHandler = breadcrumbHandler;
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* Authenticates a request by providing the identity that made the request.
|
|
@@ -52,10 +51,6 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
52
51
|
*/
|
|
53
52
|
authenticate(request, routeContext, container) {
|
|
54
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
this.breadcrumbHandler.add(request.id, `${security_module_keyname_1.SecurityModuleKeyname}:authentication.manager:authenticate:enter`, {
|
|
56
|
-
request,
|
|
57
|
-
routeContext
|
|
58
|
-
});
|
|
59
54
|
if (!routeContext || routeContext[authenticator_decorator_1.authenticatorMetadataKeyname] === undefined) {
|
|
60
55
|
return undefined;
|
|
61
56
|
}
|
|
@@ -84,7 +79,6 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
84
79
|
highlights: {
|
|
85
80
|
identity,
|
|
86
81
|
},
|
|
87
|
-
breadcrumb: `${security_module_keyname_1.SecurityModuleKeyname}:authentication.manager:authenticate:return`,
|
|
88
82
|
extra: {
|
|
89
83
|
request,
|
|
90
84
|
routeContext,
|
|
@@ -95,13 +89,18 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
95
89
|
}
|
|
96
90
|
};
|
|
97
91
|
exports.AuthenticationManager = AuthenticationManager;
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, common_1.traced)(),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", [common_1.Request, Object, Object]),
|
|
96
|
+
__metadata("design:returntype", Promise)
|
|
97
|
+
], AuthenticationManager.prototype, "authenticate", null);
|
|
98
98
|
exports.AuthenticationManager = AuthenticationManager = __decorate([
|
|
99
99
|
(0, common_1.moduleScoped)(security_module_keyname_1.SecurityModuleKeyname),
|
|
100
100
|
(0, common_1.tag)("AuthenticationManagerInterface"),
|
|
101
101
|
(0, tsyringe_1.injectable)(),
|
|
102
102
|
__param(0, (0, tsyringe_1.injectAll)(common_1.ServiceDefinitionTagEnum.IdentityProvider, { isOptional: true })),
|
|
103
103
|
__param(1, (0, tsyringe_1.inject)("LogHandlerInterface")),
|
|
104
|
-
|
|
105
|
-
__metadata("design:paramtypes", [Array, Object, authenticator_factory_1.AuthenticatorFactory, Object])
|
|
104
|
+
__metadata("design:paramtypes", [Array, Object, authenticator_factory_1.AuthenticatorFactory])
|
|
106
105
|
], AuthenticationManager);
|
|
107
106
|
//# sourceMappingURL=authentication.manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/managers/authentication.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4E;AAE5E,
|
|
1
|
+
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/managers/authentication.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,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,0DAA0D,EAAE;oBAChF,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC;iBAClB,CAAC,CAAC;gBACH,MAAM,CAAC,CAAC;YACV,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kCAAkC,EAAE;gBACvD,UAAU,EAAE;oBACV,QAAQ;iBACT;gBACD,KAAK,EAAE;oBACL,OAAO;oBACP,YAAY;iBACb;aACF,CAAC,CAAA;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAA;AAlEY,sDAAqB;AAqBnB;IADZ,IAAA,eAAM,GAAE;;qCAC0B,gBAAO;;yDA4CzC;gCAjEU,qBAAqB;IAHjC,IAAA,qBAAY,EAAC,+CAAqB,CAAC;IACnC,IAAA,YAAG,EAAC,gCAAgC,CAAC;IACrC,IAAA,qBAAU,GAAE;IAUR,WAAA,IAAA,oBAAS,EAAC,iCAAwB,CAAC,gBAAgB,EAAE,EAAC,UAAU,EAAE,IAAI,EAAC,CAAC,CAAA;IACxE,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;oDACS,4CAAoB;GAXlD,qBAAqB,CAkEjC"}
|
|
@@ -36,12 +36,10 @@ let AuthorizerManager = class AuthorizerManager {
|
|
|
36
36
|
* The authorizer manager provides authorization by authorizing the action.
|
|
37
37
|
* @param logHandler The log handler to output logs.
|
|
38
38
|
* @param guardFactory The factory to create the guard.
|
|
39
|
-
* @param breadcrumbHandler
|
|
40
39
|
*/
|
|
41
|
-
constructor(logHandler, guardFactory
|
|
40
|
+
constructor(logHandler, guardFactory) {
|
|
42
41
|
this.logHandler = logHandler;
|
|
43
42
|
this.guardFactory = guardFactory;
|
|
44
|
-
this.breadcrumbHandler = breadcrumbHandler;
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
45
|
* Returns whether or not the request is authorized to access the route.
|
|
@@ -53,11 +51,6 @@ let AuthorizerManager = class AuthorizerManager {
|
|
|
53
51
|
isAuthorized(request, routeContext, container, identity) {
|
|
54
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
53
|
var _a, _b, _c;
|
|
56
|
-
// If there are no guards defined, we simply return that it is authorized.
|
|
57
|
-
this.breadcrumbHandler.add(request.id, `${security_module_keyname_1.SecurityModuleKeyname}:authorizer.manager:isAuthorized:enter`, {
|
|
58
|
-
request,
|
|
59
|
-
routeContext
|
|
60
|
-
});
|
|
61
54
|
if (!routeContext || routeContext[guard_decorator_1.guardMetadataKeyname] === undefined || Array.isArray(routeContext[guard_decorator_1.guardMetadataKeyname]) === false) {
|
|
62
55
|
return true;
|
|
63
56
|
}
|
|
@@ -87,31 +80,26 @@ let AuthorizerManager = class AuthorizerManager {
|
|
|
87
80
|
isAuthorized = false;
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
breadcrumb: `${security_module_keyname_1.SecurityModuleKeyname}:authorizer.manager:isAuthorized:return`
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
this.logHandler.info(`User authorized`, {
|
|
99
|
-
headlights: { isAuthorized },
|
|
100
|
-
extra: { request, routeContext },
|
|
101
|
-
breadcrumb: `${security_module_keyname_1.SecurityModuleKeyname}:authorizer.manager:isAuthorized:return`
|
|
102
|
-
});
|
|
103
|
-
}
|
|
83
|
+
this.logHandler.info(`User authorized`, {
|
|
84
|
+
headlights: { isAuthorized },
|
|
85
|
+
extra: { request, routeContext },
|
|
86
|
+
});
|
|
104
87
|
return isAuthorized;
|
|
105
88
|
});
|
|
106
89
|
}
|
|
107
90
|
};
|
|
108
91
|
exports.AuthorizerManager = AuthorizerManager;
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, common_1.traced)(),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", [common_1.Request, Object, Object, Object]),
|
|
96
|
+
__metadata("design:returntype", Promise)
|
|
97
|
+
], AuthorizerManager.prototype, "isAuthorized", null);
|
|
109
98
|
exports.AuthorizerManager = AuthorizerManager = __decorate([
|
|
110
99
|
(0, common_1.moduleScoped)(security_module_keyname_1.SecurityModuleKeyname),
|
|
111
100
|
(0, common_1.tag)("AuthorizerManagerInterface"),
|
|
112
101
|
(0, tsyringe_1.injectable)(),
|
|
113
102
|
__param(0, (0, tsyringe_1.inject)("LogHandlerInterface")),
|
|
114
|
-
|
|
115
|
-
__metadata("design:paramtypes", [Object, guard_factory_1.GuardFactory, Object])
|
|
103
|
+
__metadata("design:paramtypes", [Object, guard_factory_1.GuardFactory])
|
|
116
104
|
], AuthorizerManager);
|
|
117
105
|
//# sourceMappingURL=authorizer.manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizer.manager.js","sourceRoot":"","sources":["../../../../src/managers/authorizer.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAiE;AAEjE,
|
|
1
|
+
{"version":3,"file":"authorizer.manager.js","sourceRoot":"","sources":["../../../../src/managers/authorizer.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAiE;AAEjE,gDAA0F;AAE1F,8DAAwD;AACxD,wEAAiE;AACjE,mEAAmE;AAEnE;;;GAGG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE5B;;;;OAIG;IACH,YAAmE,UAA+B,EAC9D,YAA0B;QADK,eAAU,GAAV,UAAU,CAAqB;QAC9D,iBAAY,GAAZ,YAAY,CAAc;IAC9D,CAAC;IAED;;;;;;OAMG;IAEU,YAAY,CAAC,OAAgB,EAAE,YAAiB,EAAE,SAA8B,EAAE,QAA4B;;;YACzH,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,sCAAoB,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,sCAAoB,CAAC,CAAC,KAAK,KAAK,EAA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