@riocrypto/common-server 1.0.692 → 1.0.693
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.
|
@@ -23,7 +23,6 @@ const secret_manager_client_1 = require("../clients/secret-manager-client");
|
|
|
23
23
|
const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
25
25
|
const apiKey = req.header("x-api-key");
|
|
26
|
-
console.log("x-api-key is ", apiKey);
|
|
27
26
|
let missingKYC = false;
|
|
28
27
|
if (authorizationTypes.includes(common_1.AuthorizationType.AdminAPI)) {
|
|
29
28
|
let apiKey = req.header("x-api-key");
|
|
@@ -214,6 +213,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
214
213
|
!req.validAdminApiKey &&
|
|
215
214
|
!req.currentPartnerAuth &&
|
|
216
215
|
!authorizationTypes.includes(common_1.AuthorizationType.Public))) {
|
|
216
|
+
console.log("missing auth");
|
|
217
|
+
console.log("currentAdminAuth, ", req.currentAdminAuth);
|
|
218
|
+
console.log(authorizationTypes);
|
|
217
219
|
if (!req.user &&
|
|
218
220
|
authorizationTypes.includes(common_1.AuthorizationType.UserOptional)) {
|
|
219
221
|
next();
|
|
@@ -221,12 +223,14 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
221
223
|
}
|
|
222
224
|
if (req.currentAdminAuth &&
|
|
223
225
|
authorizationTypes.includes(common_1.AuthorizationType.Admin)) {
|
|
226
|
+
console.log("safe");
|
|
224
227
|
next();
|
|
225
228
|
return;
|
|
226
229
|
}
|
|
227
230
|
if (missingKYC) {
|
|
228
231
|
throw new common_1.MissingKYCApprovalError();
|
|
229
232
|
}
|
|
233
|
+
console.log("not safe");
|
|
230
234
|
if ((authorizationTypes.includes(common_1.AuthorizationType.User) ||
|
|
231
235
|
authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC)) &&
|
|
232
236
|
((_h = req.cookies) === null || _h === void 0 ? void 0 : _h.accessToken)) {
|