@sdflc/backend-helpers 1.0.56 → 1.0.57
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/build/BaseCore.js
CHANGED
|
@@ -558,10 +558,10 @@ class BaseCore {
|
|
|
558
558
|
return spaceResult;
|
|
559
559
|
}
|
|
560
560
|
const token = ((_a = req.cookies) === null || _a === void 0 ? void 0 : _a[space.cookieName]) || context.authorization;
|
|
561
|
-
const
|
|
561
|
+
const fingerprint = ((_b = req.cookies) === null || _b === void 0 ? void 0 : _b[space.fingerprintCookieName]) || '';
|
|
562
562
|
const { jwtSecret, verifyTokenArgs } = yield this.getJwtTokenSecretAndSettings(params);
|
|
563
563
|
if (token && jwtSecret) {
|
|
564
|
-
const verifyResult = (0, userToken_1.verifyUserToken)(token, jwtSecret, verifyTokenArgs);
|
|
564
|
+
const verifyResult = (0, userToken_1.verifyUserToken)(token, jwtSecret, Object.assign(Object.assign({}, verifyTokenArgs), { fingerprint }));
|
|
565
565
|
if (verifyResult.didFail()) {
|
|
566
566
|
return [false, verifyResult.getErrorSummary('')];
|
|
567
567
|
}
|
package/build/userToken.js
CHANGED
|
@@ -33,7 +33,7 @@ const createUserToken = (params, secret, opt) => {
|
|
|
33
33
|
};
|
|
34
34
|
exports.createUserToken = createUserToken;
|
|
35
35
|
const verifyUserToken = (token, secret, args) => {
|
|
36
|
-
const { algorithms, audience, issuer, ignoreExpiration, ignoreNotBefore, subject, clockTolerance, maxAge, clockTimestamp, nonce,
|
|
36
|
+
const { algorithms, audience, issuer, ignoreExpiration, ignoreNotBefore, subject, clockTolerance, maxAge, clockTimestamp, nonce, fingerprint, } = args || {};
|
|
37
37
|
if (!args) {
|
|
38
38
|
return api_helpers_1.OpResult.fail(api_helpers_1.OP_RESULT_CODES.VALIDATION_FAILED, null, 'Cannot verify user token as there are no parameters specified');
|
|
39
39
|
}
|
|
@@ -50,7 +50,7 @@ const verifyUserToken = (token, secret, args) => {
|
|
|
50
50
|
clockTimestamp,
|
|
51
51
|
nonce,
|
|
52
52
|
});
|
|
53
|
-
if ((obj === null || obj === void 0 ? void 0 : obj.fingerprint) && obj.fingerprint !=
|
|
53
|
+
if ((obj === null || obj === void 0 ? void 0 : obj.fingerprint) && obj.fingerprint != fingerprint) {
|
|
54
54
|
return api_helpers_1.OpResult.fail(api_helpers_1.OP_RESULT_CODES.UNAUTHORIZED, null, 'User unauthenticated');
|
|
55
55
|
}
|
|
56
56
|
return api_helpers_1.OpResult.ok(obj);
|
package/package.json
CHANGED