@pristine-ts/security 0.0.371 → 0.0.372
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/guards/role.guard.js +3 -3
- package/dist/lib/cjs/guards/role.guard.js.map +1 -1
- package/dist/lib/cjs/managers/authentication.manager.js +1 -1
- package/dist/lib/cjs/managers/authentication.manager.js.map +1 -1
- package/dist/lib/cjs/managers/authorizer.manager.js +1 -1
- package/dist/lib/cjs/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/cjs/managers/permission.manager.js +12 -10
- package/dist/lib/cjs/managers/permission.manager.js.map +1 -1
- package/dist/lib/esm/guards/role.guard.js +3 -3
- package/dist/lib/esm/guards/role.guard.js.map +1 -1
- package/dist/lib/esm/managers/authentication.manager.js +1 -1
- package/dist/lib/esm/managers/authentication.manager.js.map +1 -1
- package/dist/lib/esm/managers/authorizer.manager.js +1 -1
- package/dist/lib/esm/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/esm/managers/permission.manager.js +12 -10
- package/dist/lib/esm/managers/permission.manager.js.map +1 -1
- package/package.json +4 -4
|
@@ -47,7 +47,7 @@ let RoleGuard = class RoleGuard {
|
|
|
47
47
|
setContext(context) {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
this.guardContext = context;
|
|
50
|
-
this.logHandler.debug("Setting the
|
|
50
|
+
this.logHandler.debug("RoleGuard: Setting context for the guard.", { extra: { context } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
51
51
|
return Promise.resolve();
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -72,13 +72,13 @@ let RoleGuard = class RoleGuard {
|
|
|
72
72
|
}
|
|
73
73
|
// If the identity does not have a roles claim, we deny.
|
|
74
74
|
if (neededRoles.length > 0 && (((_a = identity === null || identity === void 0 ? void 0 : identity.claims) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(this.rolesClaimKey)) === false || !Array.isArray(identity === null || identity === void 0 ? void 0 : identity.claims[this.rolesClaimKey]))) {
|
|
75
|
-
this.logHandler.debug("Identity doesn't have a roles claim
|
|
75
|
+
this.logHandler.debug("RoleGuard: Identity doesn't have a roles claim, denying access.", { extra: { request, identity, neededRoles } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
// If the identity is missing one of the needed roles, we deny.
|
|
79
79
|
for (const role of neededRoles) {
|
|
80
80
|
if (!(identity === null || identity === void 0 ? void 0 : identity.claims[this.rolesClaimKey].includes(role))) {
|
|
81
|
-
this.logHandler.debug("Role not found in claims
|
|
81
|
+
this.logHandler.debug("RoleGuard: Role not found in claims, denying access.", { extra: { request, identity, neededRoles, role } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../../src/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAM5C,wEAAiE;AAEjE;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAS;IAWlB;;;OAGG;IACH,YAAyD,aAAsC,EACpD,UAAgD;QADjB,kBAAa,GAAb,aAAa,CAAQ;QACnC,eAAU,GAAV,UAAU,CAAqB;QAf3F;;WAEG;QACI,YAAO,GAAG,MAAM,CAAC;IAaxB,CAAC;IAED;;;OAGG;IACG,UAAU,CAAC,OAAY;;YACzB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAE5B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../../src/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA4C;AAM5C,wEAAiE;AAEjE;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAS;IAWlB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AAa,CAAC,CAAC,CAAC,EAAC,CAAC;gBACnJ,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,iEAAiE,EAAE,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAC,EAAC,EAAE,+CAAqB,CAAC,CAAC;gBAC3J,OAAO,KAAK,CAAC;YACjB,CAAC;YAED,+DAA+D;YAC/D,KAAI,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAC5B,IAAG,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA,EAAC,CAAC;oBACrD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sDAAsD,EAAE,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAC,EAAC,EAAE,+CAAqB,CAAC,CAAC;oBACtJ,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;YAED,4DAA4D;YAC5D,OAAO,IAAI,CAAC;;KACf;CACJ,CAAA;AApEY,8BAAS;oBAAT,SAAS;IADrB,IAAA,qBAAU,GAAE;IAgBI,WAAA,IAAA,iBAAM,EAAC,mCAAmC,CAAC,CAAA;IAC3C,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;;GAhBjC,SAAS,CAoErB"}
|
|
@@ -70,7 +70,7 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
catch (e) {
|
|
73
|
-
this.logHandler.error(
|
|
73
|
+
this.logHandler.error("AuthenticationManager: Error authenticating the request.", { extra: { error: e } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
74
74
|
throw e;
|
|
75
75
|
}
|
|
76
76
|
return identity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.manager.js","sourceRoot":"","sources":["../../../../src/manag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T,IAAI,CAAC,UAAU,CAAC,KAAK,
|
|
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,CAA6B;QACrE,eAAU,GAAV,UAAU,CAAqB;QAC/C,yBAAoB,GAApB,oBAAoB,CAAsB;IAC9E,CAAC;IAED;;;;;OAKG;IACU,YAAY,CAAC,OAAgB,EAAE,YAAiB,EAAE,SAA8B;;YACzF,IAAG,CAAC,YAAY,IAAI,YAAY,CAAC,sDAA4B,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC3E,OAAO,SAAS,CAAC;YACrB,CAAC;YAED,MAAM,aAAa,GAAG,YAAY,CAAC,sDAA4B,CAAC,CAAC;YAEjE,IAAI,QAAuC,CAAC;YAE5C,MAAM,oBAAoB,GAAkC,aAAa,CAAC;YAE1E,IAAI,CAAC;gBACD,MAAM,yBAAyB,GAA2B,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;gBAEjI,MAAM,yBAAyB,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;gBAEjE,QAAQ,GAAG,MAAM,yBAAyB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBAEjE,IAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;oBACvB,OAAO,QAAQ,CAAC;gBACpB,CAAC;gBAED,mCAAmC;gBACnC,KAAK,MAAM,gBAAgB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBACpD,QAAQ,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxD,CAAC;YAEL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,0DAA0D,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC,EAAC,EAAE,+CAAqB,CAAC,CAAC;gBAC9H,MAAM,CAAC,CAAC;YACZ,CAAC;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ,CAAA;AAtDY,sDAAqB;gCAArB,qBAAqB;IAHjC,IAAA,qBAAY,EAAC,+CAAqB,CAAC;IACnC,IAAA,YAAG,EAAC,gCAAgC,CAAC;IACrC,IAAA,qBAAU,GAAE;IAUJ,WAAA,IAAA,oBAAS,EAAC,iCAAwB,CAAC,gBAAgB,CAAC,CAAA;IACpD,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;oDACwB,4CAAoB;GAXrE,qBAAqB,CAsDjC"}
|
|
@@ -64,7 +64,7 @@ let AuthorizerManager = class AuthorizerManager {
|
|
|
64
64
|
isAuthorized = isAuthorized && didAuthorize;
|
|
65
65
|
}
|
|
66
66
|
catch (e) {
|
|
67
|
-
this.logHandler.error(
|
|
67
|
+
this.logHandler.error("AuthorizerManager: Error while authorizing the request.", { extra: { error: e } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
68
68
|
isAuthorized = false;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -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;AAEjE,mEAAmE;AAEnE;;;GAGG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE1B;;;;OAIG;IACH,YAAmE,UAA+B,EAC9D,YAA0B;QADK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AqB,CAAC,CAAA;6CACC,4BAAY;GARrD,iBAAiB,CA8C7B"}
|
|
@@ -51,31 +51,33 @@ let PermissionManager = class PermissionManager {
|
|
|
51
51
|
hasAccessToResource(identity, action, resource, votingStrategy = voting_strategy_enum_1.VotingStrategyEnum.DenyOnUnanimousAbstention) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
if (this.voters.length === 0) {
|
|
54
|
-
this.logHandler.warning("
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
this.logHandler.warning("PermissionManager: No voters were found, this could lead to unexpected behavior. Make sure that you have registered voters in your application.", {
|
|
55
|
+
extra: {
|
|
56
|
+
identity,
|
|
57
|
+
action,
|
|
58
|
+
resource,
|
|
59
|
+
}
|
|
58
60
|
}, security_module_keyname_1.SecurityModuleKeyname);
|
|
59
61
|
}
|
|
60
62
|
const votes = [];
|
|
61
63
|
for (const voter of this.voters) {
|
|
62
64
|
if (voter.supports(resource) === false) {
|
|
63
|
-
this.logHandler.debug("
|
|
65
|
+
this.logHandler.debug("PermissionManager: voter does not support this resource.", { extra: { identity, action, resource, voter: voter.constructor.name } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
64
66
|
continue;
|
|
65
67
|
}
|
|
66
68
|
try {
|
|
67
69
|
const vote = yield voter.vote(identity, action, resource);
|
|
68
|
-
const message = "
|
|
70
|
+
const message = "PermissionManager: Voter " + voter.constructor.name + " voted: " + vote;
|
|
69
71
|
if (vote === vote_enum_1.VoteEnum.Deny) { // When it's being denied, it usually mean that something is important to be noticed.
|
|
70
|
-
this.logHandler.info(message, { identity, action, resource, voter: voter.constructor.name }, security_module_keyname_1.SecurityModuleKeyname);
|
|
72
|
+
this.logHandler.info(message, { extra: { identity, action, resource, voter: voter.constructor.name } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
71
73
|
}
|
|
72
74
|
else {
|
|
73
|
-
this.logHandler.debug(
|
|
75
|
+
this.logHandler.debug(message, { extra: { identity, action, resource, voter: voter.constructor.name } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
74
76
|
}
|
|
75
77
|
votes.push(vote);
|
|
76
78
|
}
|
|
77
79
|
catch (error) {
|
|
78
|
-
this.logHandler.error("Error while voting", { error, resource, voter: voter.constructor.name }, security_module_keyname_1.SecurityModuleKeyname);
|
|
80
|
+
this.logHandler.error("PermissionManager: Error while voting, please check the logs for more details.", { extra: { error, resource, voter: voter.constructor.name } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
79
81
|
throw error;
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -85,7 +87,7 @@ let PermissionManager = class PermissionManager {
|
|
|
85
87
|
shouldGrantAccess = false;
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
|
-
this.logHandler.info("
|
|
90
|
+
this.logHandler.info("PermissionManager: Access to resource " + resource.constructor.name + " was " + (shouldGrantAccess ? "GRANTED" : "DENIED"), { extra: { identity, action, resource } }, security_module_keyname_1.SecurityModuleKeyname);
|
|
89
91
|
return shouldGrantAccess;
|
|
90
92
|
});
|
|
91
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.manager.js","sourceRoot":"","sources":["../../../../src/managers/permission.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuD;AAEvD,wEAAiE;AAEjE,kDAA4C;AAC5C,gDAAgF;AAChF,wEAAiE;AAEjE;;GAEG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE1B;;;;;OAKG;IACH,YAA+E,MAAwB,EACpC,UAA+B;QADnB,WAAM,GAAN,MAAM,CAAkB;QACpC,eAAU,GAAV,UAAU,CAAqB;IAClG,CAAC;IAED;;;;;;OAMG;IACG,mBAAmB,CAAC,QAA2B,EAAE,MAAc,EAAE,QAAgB,EAAE,iBAAqC,yCAAkB,CAAC,yBAAyB;;YAEtK,IAAG,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAC,C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AAE,CAAC,IAAI,KAAK,oBAAQ,CAAC,OAAO,CAAC,EAAC,CAAC;oBACvE,iBAAiB,GAAG,KAAK,CAAC;gBAC9B,CAAC;YACL,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,wCAAwC,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,OAAO,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAC,EAAC,EAAE,+CAAqB,CAAC,CAAC;YAEhN,OAAO,iBAAiB,CAAC;QAC7B,CAAC;KAAA;CACJ,CAAA;AAvEY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,qBAAU,GAAE;IASW,WAAA,IAAA,oBAAS,EAAC,iCAAwB,CAAC,KAAK,CAAC,CAAA;IACzC,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;;GATxC,iBAAiB,CAuE7B"}
|
|
@@ -44,7 +44,7 @@ let RoleGuard = class RoleGuard {
|
|
|
44
44
|
setContext(context) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
this.guardContext = context;
|
|
47
|
-
this.logHandler.debug("Setting the
|
|
47
|
+
this.logHandler.debug("RoleGuard: Setting context for the guard.", { extra: { context } }, SecurityModuleKeyname);
|
|
48
48
|
return Promise.resolve();
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -69,13 +69,13 @@ let RoleGuard = class RoleGuard {
|
|
|
69
69
|
}
|
|
70
70
|
// If the identity does not have a roles claim, we deny.
|
|
71
71
|
if (neededRoles.length > 0 && (((_a = identity === null || identity === void 0 ? void 0 : identity.claims) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(this.rolesClaimKey)) === false || !Array.isArray(identity === null || identity === void 0 ? void 0 : identity.claims[this.rolesClaimKey]))) {
|
|
72
|
-
this.logHandler.debug("Identity doesn't have a roles claim
|
|
72
|
+
this.logHandler.debug("RoleGuard: Identity doesn't have a roles claim, denying access.", { extra: { request, identity, neededRoles } }, SecurityModuleKeyname);
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
75
|
// If the identity is missing one of the needed roles, we deny.
|
|
76
76
|
for (const role of neededRoles) {
|
|
77
77
|
if (!(identity === null || identity === void 0 ? void 0 : identity.claims[this.rolesClaimKey].includes(role))) {
|
|
78
|
-
this.logHandler.debug("Role not found in claims
|
|
78
|
+
this.logHandler.debug("RoleGuard: Role not found in claims, denying access.", { extra: { request, identity, neededRoles, role } }, SecurityModuleKeyname);
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../../src/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAM5C,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAEjE;;GAEG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAS;IAWlB;;;OAGG;IACH,YAAyD,aAAsC,EACpD,UAAgD;QADjB,kBAAa,GAAb,aAAa,CAAQ;QACnC,eAAU,GAAV,UAAU,CAAqB;QAf3F;;WAEG;QACI,YAAO,GAAG,MAAM,CAAC;IAaxB,CAAC;IAED;;;OAGG;IACG,UAAU,CAAC,OAAY;;YACzB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAE5B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"role.guard.js","sourceRoot":"","sources":["../../../../src/guards/role.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAM5C,OAAO,EAAC,qBAAqB,EAAC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OAAO,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAC,CAAC;gBACnJ,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,iEAAiE,EAAE,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAC,EAAC,EAAE,qBAAqB,CAAC,CAAC;gBAC3J,OAAO,KAAK,CAAC;YACjB,CAAC;YAED,+DAA+D;YAC/D,KAAI,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAC5B,IAAG,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA,EAAC,CAAC;oBACrD,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sDAAsD,EAAE,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAC,EAAC,EAAE,qBAAqB,CAAC,CAAC;oBACtJ,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;YAED,4DAA4D;YAC5D,OAAO,IAAI,CAAC;;KACf;CACJ,CAAA;AApEY,SAAS;IADrB,UAAU,EAAE;IAgBI,WAAA,MAAM,CAAC,mCAAmC,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;;GAhBjC,SAAS,CAoErB"}
|
|
@@ -67,7 +67,7 @@ let AuthenticationManager = class AuthenticationManager {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
catch (e) {
|
|
70
|
-
this.logHandler.error(
|
|
70
|
+
this.logHandler.error("AuthenticationManager: Error authenticating the request.", { extra: { error: e } }, SecurityModuleKeyname);
|
|
71
71
|
throw e;
|
|
72
72
|
}
|
|
73
73
|
return identity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.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,EAAE,CAAC;oBACvB,OAAO,QAAQ,CAAC;gBACpB,CAAC;gBAED,mCAAmC;gBACnC,KAAK,MAAM,gBAAgB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBACpD,QAAQ,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxD,CAAC;YAEL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,UAAU,CAAC,KAAK,
|
|
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,EAAE,YAAiB,EAAE,SAA8B;;YACzF,IAAG,CAAC,YAAY,IAAI,YAAY,CAAC,4BAA4B,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC3E,OAAO,SAAS,CAAC;YACrB,CAAC;YAED,MAAM,aAAa,GAAG,YAAY,CAAC,4BAA4B,CAAC,CAAC;YAEjE,IAAI,QAAuC,CAA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ler.error("AuthorizerManager: Error while authorizing the request.", { extra: { error: e } }, SecurityModuleKeyname);
|
|
65
65
|
isAuthorized = false;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -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;AAEjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AAEnE;;;GAGG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE1B;;;;OAIG;IACH,YAAmE,UAA+B,EAC9D,YAA0B;QADK,eAAU,GAAV,UAAU,CAAqB;QAC9D,iBAAY,GAAZ,YAAY,CAAc;IAC9D,CAAC;IAED;;;;;;OAMG;IACU,YAAY,CAAC,OAAgB,EAAE,YAAiB,EAAE,SAA8B,EAAE,QAA4B;;YACvH,0EAA0E;YAE1E,IAAG,CAAC,YAAY,IAAI,YAAY,CAAC,oBAAoB,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;gBAClI,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,MAAM,MAAM,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;YAElD,IAAI,YAAY,GAAG,IAAI,CAAC;YAExB,KAAK,MAAM,YAAY,IAAI,MAAM,EAAE,CAAC;gBAChC,IAAI,CAAC;oBACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,YAAY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D,IAAI,YAAY,GAAG,IAAI,CAAC;YAExB,KAAK,MAAM,YAAY,IAAI,MAAM,EAAE,CAAC;gBAChC,IAAI,CAAC;oBACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;oBAEjF,MAAM,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;oBAEjD,MAAM,YAAY,GAAE,MAAM,iBAAiB,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAC5E,YAAY,GAAG,YAAY,IAAI,YAAY,CAAC;gBAChD,CAAC;gBACD,OAAO,CAAC,EAAE,CAAC;oBACP,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,yDAAyD,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAC,EAAC,EAAE,qBAAqB,CAAC,CAAC;oBAC7H,YAAY,GAAG,KAAK,CAAC;gBACzB,CAAC;YACL,CAAC;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"}
|
|
@@ -48,31 +48,33 @@ let PermissionManager = class PermissionManager {
|
|
|
48
48
|
hasAccessToResource(identity, action, resource, votingStrategy = VotingStrategyEnum.DenyOnUnanimousAbstention) {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
50
|
if (this.voters.length === 0) {
|
|
51
|
-
this.logHandler.warning("
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
this.logHandler.warning("PermissionManager: No voters were found, this could lead to unexpected behavior. Make sure that you have registered voters in your application.", {
|
|
52
|
+
extra: {
|
|
53
|
+
identity,
|
|
54
|
+
action,
|
|
55
|
+
resource,
|
|
56
|
+
}
|
|
55
57
|
}, SecurityModuleKeyname);
|
|
56
58
|
}
|
|
57
59
|
const votes = [];
|
|
58
60
|
for (const voter of this.voters) {
|
|
59
61
|
if (voter.supports(resource) === false) {
|
|
60
|
-
this.logHandler.debug("
|
|
62
|
+
this.logHandler.debug("PermissionManager: voter does not support this resource.", { extra: { identity, action, resource, voter: voter.constructor.name } }, SecurityModuleKeyname);
|
|
61
63
|
continue;
|
|
62
64
|
}
|
|
63
65
|
try {
|
|
64
66
|
const vote = yield voter.vote(identity, action, resource);
|
|
65
|
-
const message = "
|
|
67
|
+
const message = "PermissionManager: Voter " + voter.constructor.name + " voted: " + vote;
|
|
66
68
|
if (vote === VoteEnum.Deny) { // When it's being denied, it usually mean that something is important to be noticed.
|
|
67
|
-
this.logHandler.info(message, { identity, action, resource, voter: voter.constructor.name }, SecurityModuleKeyname);
|
|
69
|
+
this.logHandler.info(message, { extra: { identity, action, resource, voter: voter.constructor.name } }, SecurityModuleKeyname);
|
|
68
70
|
}
|
|
69
71
|
else {
|
|
70
|
-
this.logHandler.debug(
|
|
72
|
+
this.logHandler.debug(message, { extra: { identity, action, resource, voter: voter.constructor.name } }, SecurityModuleKeyname);
|
|
71
73
|
}
|
|
72
74
|
votes.push(vote);
|
|
73
75
|
}
|
|
74
76
|
catch (error) {
|
|
75
|
-
this.logHandler.error("Error while voting", { error, resource, voter: voter.constructor.name }, SecurityModuleKeyname);
|
|
77
|
+
this.logHandler.error("PermissionManager: Error while voting, please check the logs for more details.", { extra: { error, resource, voter: voter.constructor.name } }, SecurityModuleKeyname);
|
|
76
78
|
throw error;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -82,7 +84,7 @@ let PermissionManager = class PermissionManager {
|
|
|
82
84
|
shouldGrantAccess = false;
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
|
-
this.logHandler.info("
|
|
87
|
+
this.logHandler.info("PermissionManager: Access to resource " + resource.constructor.name + " was " + (shouldGrantAccess ? "GRANTED" : "DENIED"), { extra: { identity, action, resource } }, SecurityModuleKeyname);
|
|
86
88
|
return shouldGrantAccess;
|
|
87
89
|
});
|
|
88
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission.manager.js","sourceRoot":"","sources":["../../../../src/managers/permission.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAoB,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAEjE;;GAEG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE1B;;;;;OAKG;IACH,YAA+E,MAAwB,EACpC,UAA+B;QADnB,WAAM,GAAN,MAAM,CAAkB;QACpC,eAAU,GAAV,UAAU,CAAqB;IAClG,CAAC;IAED;;;;;;OAMG;IACG,mBAAmB,CAAC,QAA2B,EAAE,MAAc,EAAE,QAAgB,EAAE,iBAAqC,kBAAkB,CAAC,yBAAyB;;YAEtK,IAAG,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;gBACzB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"permission.manager.js","sourceRoot":"","sources":["../../../../src/managers/permission.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC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UAAU,CAAC,IAAI,CAAC,wCAAwC,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,OAAO,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAC,EAAC,EAAE,qBAAqB,CAAC,CAAC;YAEhN,OAAO,iBAAiB,CAAC;QAC7B,CAAC;KAAA;CACJ,CAAA;AAvEY,iBAAiB;IAD7B,UAAU,EAAE;IASW,WAAA,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAA;IACzC,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;;GATxC,iBAAiB,CAuE7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/security",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.372",
|
|
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.372",
|
|
24
|
+
"@pristine-ts/logging": "^0.0.372"
|
|
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": "d8be769536e2d5e64e1479af460f1bd8c93b688d"
|
|
64
64
|
}
|