From d93236e21c4e4d19974ca4b32dea2e3e3f008416 Mon Sep 17 00:00:00 2001 From: sachin-maheshwari Date: Wed, 9 May 2018 15:51:32 +0530 Subject: [PATCH] Revert "m2m token support " --- config/custom-environment-variables.json | 4 ++-- config/default.json | 6 ++++-- config/development.json | 1 + config/test.json | 3 ++- package.json | 2 +- src/util.js | 6 ------ 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index b1a48ec5..59ff0ddd 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -1,5 +1,5 @@ { - "AUTH_SECRET": "AUTH_SECRET", + "authSecret": "AUTH_SECRET", "logLevel": "LOG_LEVEL", "version": "APP_VERSION", "captureLogs": "CAPTURE_LOGS", @@ -37,7 +37,7 @@ "minPoolSize": "DB_MIN_POOL_SIZE" }, "analyticsKey": "ANALYTICS_KEY", - "VALID_ISSUERS": "VALID_ISSUERS", + "validIssuers": "VALID_ISSUERS", "jwksUri": "JWKS_URI", "busApiUrl": "BUS_API_URL", "busApiToken": "BUS_API_TOKEN" diff --git a/config/default.json b/config/default.json index 7ec4c742..dd753d8e 100644 --- a/config/default.json +++ b/config/default.json @@ -1,5 +1,6 @@ { - "AUTH_SECRET": "secret", + "authSecret": "secret", + "authDomain": "topcoder-dev.com", "logLevel": "info", "version": "v4", "captureLogs": "false", @@ -41,7 +42,8 @@ "idleTimeout": 1000 }, "analyticsKey": "", - "VALID_ISSUERS": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]", + "validIssuers": "[\"https:\/\/topcoder-newauth.auth0.com\/\",\"https:\/\/api.topcoder-dev.com\"]", + "jwksUri": "", "busApiUrl": "http://api.topcoder-dev.com", "busApiToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoicHJvamVjdC1zZXJ2aWNlIiwiaWF0IjoxNTEyNzQ3MDgyLCJleHAiOjE1MjEzODcwODJ9.PHuNcFDaotGAL8RhQXQMdpL8yOKXxjB5DbBIodmt7RE" } diff --git a/config/development.json b/config/development.json index 7e8ce29d..b7de350a 100644 --- a/config/development.json +++ b/config/development.json @@ -1,4 +1,5 @@ { + "authDomain": "topcoder-dev.com", "pubsubQueueName": "dev.project.service", "pubsubExchangeName": "dev.projects", "attachmentsS3Bucket": "topcoder-dev-media" diff --git a/config/test.json b/config/test.json index 26d22a7a..2b045431 100644 --- a/config/test.json +++ b/config/test.json @@ -1,5 +1,6 @@ { - "AUTH_SECRET": "secret", + "authSecret": "secret", + "authDomain": "topcoder-dev.com", "logLevel": "debug", "captureLogs": "false", "logentriesToken": "", diff --git a/package.json b/package.json index 39665962..b6234466 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "pg": "^4.5.5", "pg-native": "^1.10.0", "sequelize": "^3.23.0", - "tc-core-library-js": "appirio-tech/tc-core-library-js.git#v2.3", + "tc-core-library-js": "appirio-tech/tc-core-library-js.git#v2.2", "traverse": "^0.6.6", "urlencode": "^1.1.0" }, diff --git a/src/util.js b/src/util.js index 399e119c..6371f726 100644 --- a/src/util.js +++ b/src/util.js @@ -70,8 +70,6 @@ _.assignIn(util, { * @return {boolean} true/false */ hasRole: (req, role) => { - const isMachineToken = _.get(req, 'authUser.isMachine', false); - if (isMachineToken) return true; let roles = _.get(req, 'authUser.roles', []); roles = roles.map(s => s.toLowerCase()); return _.indexOf(roles, role.toLowerCase()) >= 0; @@ -83,8 +81,6 @@ _.assignIn(util, { * @return {boolean} true/false */ hasRoles: (req, roles) => { - const isMachineToken = _.get(req, 'authUser.isMachine', false); - if (isMachineToken) return true; let authRoles = _.get(req, 'authUser.roles', []); authRoles = authRoles.map(s => s.toLowerCase()); return _.intersection(authRoles, roles.map(r => r.toLowerCase())).length > 0; @@ -105,8 +101,6 @@ _.assignIn(util, { * @return {boolean} true/false */ hasAdminRole: (req) => { - const isMachineToken = _.get(req, 'authUser.isMachine', false); - if (isMachineToken) return true; let roles = _.get(req, 'authUser.roles', []); roles = roles.map(s => s.toLowerCase()); return _.intersection(roles, ADMIN_ROLES.map(r => r.toLowerCase())).length > 0;