From b66be80f7ed4aae324a13c5ba6672aaa18303f19 Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Thu, 3 Oct 2024 02:00:52 +0300 Subject: [PATCH] [refactor] Refactoring in 'auth' --- DocService/sources/DocsCoServer.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js index 8a4ef764..ec9c59e8 100644 --- a/DocService/sources/DocsCoServer.js +++ b/DocService/sources/DocsCoServer.js @@ -2538,14 +2538,15 @@ exports.install = function(server, callbackFunction) { let validationErr = validateAuthToken(data, decoded); if (!validationErr) { fillDataFromJwtRes = fillDataFromJwt(ctx, decoded, data); - } else if (tenTokenRequiredParams) { - ctx.logger.error("auth missing required parameter %s (since 7.1 version)", validationErr); - sendDataDisconnectReason(ctx, conn, constants.JWT_ERROR_CODE, constants.JWT_ERROR_REASON); - conn.disconnect(true); - return; } else { - ctx.logger.warn("auth missing required parameter %s (since 7.1 version)", validationErr); - fillDataFromJwtRes = fillDataFromJwt(ctx, decoded, data); + ctx.logger.error("auth missing required parameter %s (since 7.1 version)", validationErr); + if (tenTokenRequiredParams) { + sendDataDisconnectReason(ctx, conn, constants.JWT_ERROR_CODE, constants.JWT_ERROR_REASON); + conn.disconnect(true); + return; + } else { + fillDataFromJwtRes = fillDataFromJwt(ctx, decoded, data); + } } } if(!fillDataFromJwtRes) {