From e17f656211e94baffc1d2660272e8998e4ac0191 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 4 Sep 2020 18:44:45 +0530 Subject: [PATCH 01/23] new auth0 url --- config/default.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index e9c1df07aa..bf9a109720 100644 --- a/config/default.js +++ b/config/default.js @@ -382,8 +382,8 @@ module.exports = { ], HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { - href: 'https://accounts.topcoder-dev.com/member/registration?utm_source=community-app-main', - location: 'https://accounts.topcoder-dev.com/member?retUrl=%S&utm_source=community-app-main', + href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main', + location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main', }, ACCOUNT_MENU: [ { From ba6c11f79c049245b84931c002a9a6eaa8b4a1dc Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Fri, 4 Sep 2020 19:04:13 +0530 Subject: [PATCH 02/23] just for bypassing condition - https://github.com/topcoder-platform/navigation-component/blob/develop/src/components/LoginNav/index.js#L125 --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index bf9a109720..435dedbe95 100644 --- a/config/default.js +++ b/config/default.js @@ -383,7 +383,7 @@ module.exports = { HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main', - location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main', + location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main&member?', }, ACCOUNT_MENU: [ { From 038a06fe62461378f17433a0161a01457b793f79 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Mon, 7 Sep 2020 18:28:31 +0530 Subject: [PATCH 03/23] fixing unit testing --- .../shared/components/Header/__snapshots__/index.jsx.snap | 4 ++-- config/default.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/shared/components/Header/__snapshots__/index.jsx.snap b/__tests__/shared/components/Header/__snapshots__/index.jsx.snap index 9f0f7a4186..fc7cd4c064 100644 --- a/__tests__/shared/components/Header/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/Header/__snapshots__/index.jsx.snap @@ -162,8 +162,8 @@ exports[`Default render 1`] = ` auth={null} authURLs={ Object { - "href": "https://accounts.topcoder-dev.com/member/registration?utm_source=community-app-main", - "location": "https://accounts.topcoder-dev.com/member?retUrl=%S&utm_source=community-app-main", + "href": "https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main", + "location": "https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main", } } loggedIn={true} diff --git a/config/default.js b/config/default.js index 435dedbe95..bf9a109720 100644 --- a/config/default.js +++ b/config/default.js @@ -383,7 +383,7 @@ module.exports = { HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { href: 'https://accounts-auth0.topcoder-dev.com?utm_source=community-app-main', - location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main&member?', + location: 'https://accounts-auth0.topcoder-dev.com?retUrl=%S&utm_source=community-app-main', }, ACCOUNT_MENU: [ { From 238edf3845ea390075f9895e04937280957e37b0 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 8 Sep 2020 18:31:28 +0530 Subject: [PATCH 04/23] adding changes for new auth flow --- .circleci/config.yml | 1 + __tests__/client/client.jsx | 2 +- __tests__/shared/reducers/auth.js | 2 +- __tests__/shared/reducers/challenge.js | 2 +- config/default.js | 2 +- package.json | 2 +- src/client/index.jsx | 2 +- src/shared/actions/challenge-listing/index.js | 2 +- src/shared/components/challenge-detail/MySubmissions/index.jsx | 2 +- src/shared/components/challenge-detail/Submissions/index.jsx | 2 +- src/shared/containers/Dashboard/index.jsx | 2 +- src/shared/containers/EmailVerification/index.jsx | 2 +- src/shared/containers/Settings.jsx | 2 +- src/shared/reducers/tc-communities/index.js | 2 +- src/shared/utils/tc.js | 2 +- 15 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d9e4f88a90..f98f1a1084 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,6 +239,7 @@ workflows: only: - feature-contentful - hot-fix + - feature/auth0-RS256-Idtoken # This is alternate dev env for parallel testing - "build-qa": context : org-global diff --git a/__tests__/client/client.jsx b/__tests__/client/client.jsx index cf90a63944..f76a304068 100644 --- a/__tests__/client/client.jsx +++ b/__tests__/client/client.jsx @@ -106,7 +106,7 @@ const mockTcAccounts = { decodeToken: () => ({ exp: Date.now() }), getFreshToken: () => Promise.resolve(tokenV3), }; -jest.setMock('tc-accounts', mockTcAccounts); +jest.setMock('tc-auth-lib', mockTcAccounts); /* Mock auth actions */ /* diff --git a/__tests__/shared/reducers/auth.js b/__tests__/shared/reducers/auth.js index 5427774916..d6c9f923bc 100644 --- a/__tests__/shared/reducers/auth.js +++ b/__tests__/shared/reducers/auth.js @@ -24,7 +24,7 @@ const mockActions = { _.merge(actions, mockActions); -jest.setMock('tc-accounts', { +jest.setMock('tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/__tests__/shared/reducers/challenge.js b/__tests__/shared/reducers/challenge.js index dab9dd39c0..a65d45fea6 100644 --- a/__tests__/shared/reducers/challenge.js +++ b/__tests__/shared/reducers/challenge.js @@ -11,7 +11,7 @@ import { mock, actions } from 'topcoder-react-lib'; const { mockAction } = mock; -jest.setMock('tc-accounts', { +jest.setMock('tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/config/default.js b/config/default.js index bf9a109720..e28c1030a2 100644 --- a/config/default.js +++ b/config/default.js @@ -104,7 +104,7 @@ module.exports = { * platform. */ URL: { /* Connector URL of the TC accounts App. */ - ACCOUNTS_APP_CONNECTOR: 'https://accounts.topcoder-dev.com/connector.html', + ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder-dev.com', /* The remote address where the app is deployed. */ APP: 'https://community-app.topcoder-dev.com', diff --git a/package.json b/package.json index d284ae8360..d44fbbc9a3 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev", + "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#master", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.3", diff --git a/src/client/index.jsx b/src/client/index.jsx index c5ad157536..62f6f7063d 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -11,7 +11,7 @@ import { configureConnector, decodeToken, getFreshToken, -} from 'tc-accounts'; +} from 'tc-auth-lib'; import { actions, logger, errors } from 'topcoder-react-lib'; import { client, redux } from 'topcoder-react-utils'; diff --git a/src/shared/actions/challenge-listing/index.js b/src/shared/actions/challenge-listing/index.js index a33623e9b7..c03710a480 100644 --- a/src/shared/actions/challenge-listing/index.js +++ b/src/shared/actions/challenge-listing/index.js @@ -4,7 +4,7 @@ import _ from 'lodash'; import { createActions } from 'redux-actions'; -import { decodeToken } from 'tc-accounts'; +import { decodeToken } from 'tc-auth-lib'; import 'isomorphic-fetch'; import { processSRM } from 'utils/tc'; import { errors, services } from 'topcoder-react-lib'; diff --git a/src/shared/components/challenge-detail/MySubmissions/index.jsx b/src/shared/components/challenge-detail/MySubmissions/index.jsx index 8687914a85..a450dd32cf 100644 --- a/src/shared/components/challenge-detail/MySubmissions/index.jsx +++ b/src/shared/components/challenge-detail/MySubmissions/index.jsx @@ -7,7 +7,7 @@ import PT from 'prop-types'; import _ from 'lodash'; import { goToLogin } from 'utils/tc'; import LoadingIndicator from 'components/LoadingIndicator'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import SubmissionsList from './SubmissionsList'; import SubmissionsDetail from './SubmissionsDetail'; diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index bf0beda012..f3ead12c3f 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -11,7 +11,7 @@ import _ from 'lodash'; import { connect } from 'react-redux'; import { config } from 'topcoder-react-utils'; import { submission as submissionUtils } from 'topcoder-react-lib'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import cn from 'classnames'; import { PrimaryButton } from 'topcoder-react-ui-kit'; diff --git a/src/shared/containers/Dashboard/index.jsx b/src/shared/containers/Dashboard/index.jsx index 866cc83742..6e4cd40ad3 100644 --- a/src/shared/containers/Dashboard/index.jsx +++ b/src/shared/containers/Dashboard/index.jsx @@ -25,7 +25,7 @@ import { updateChallengeType } from 'utils/challenge'; import challengeListingActions from 'actions/challenge-listing'; import communityActions from 'actions/tc-communities'; -import { isTokenExpired, decodeToken } from 'tc-accounts'; +import { isTokenExpired, decodeToken } from 'tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import './styles.scss'; diff --git a/src/shared/containers/EmailVerification/index.jsx b/src/shared/containers/EmailVerification/index.jsx index 66bc337c4b..eee56a96e5 100644 --- a/src/shared/containers/EmailVerification/index.jsx +++ b/src/shared/containers/EmailVerification/index.jsx @@ -8,7 +8,7 @@ import PT from 'prop-types'; import {connect} from "react-redux"; import { actions } from "topcoder-react-lib"; import { Redirect } from 'react-router'; -import {isTokenExpired} from "tc-accounts"; +import {isTokenExpired} from "tc-auth-lib"; import * as queryString from 'query-string'; import LoadingIndicator from 'components/LoadingIndicator'; import Error404 from 'components/Error404'; diff --git a/src/shared/containers/Settings.jsx b/src/shared/containers/Settings.jsx index 40009cef92..1d43a99cb0 100644 --- a/src/shared/containers/Settings.jsx +++ b/src/shared/containers/Settings.jsx @@ -6,7 +6,7 @@ import React from 'react'; import PT from 'prop-types'; import { connect } from 'react-redux'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import { goToLogin } from 'utils/tc'; import { actions } from 'topcoder-react-lib'; diff --git a/src/shared/reducers/tc-communities/index.js b/src/shared/reducers/tc-communities/index.js index b915416d12..c7db77ae7f 100644 --- a/src/shared/reducers/tc-communities/index.js +++ b/src/shared/reducers/tc-communities/index.js @@ -8,7 +8,7 @@ import _ from 'lodash'; import actions from 'actions/tc-communities'; import { logger, services, errors } from 'topcoder-react-lib'; import { handleActions } from 'redux-actions'; -import { decodeToken } from 'tc-accounts'; +import { decodeToken } from 'tc-auth-lib'; import { getAuthTokens } from 'utils/tc'; import { STATE as JOIN_COMMUNITY } from 'components/tc-communities/JoinCommunity'; import { getCommunityId } from 'server/services/communities'; diff --git a/src/shared/utils/tc.js b/src/shared/utils/tc.js index 92c93c9ca6..8aff2c8620 100644 --- a/src/shared/utils/tc.js +++ b/src/shared/utils/tc.js @@ -5,7 +5,7 @@ import _ from 'lodash'; import moment from 'moment-timezone'; -import { isTokenExpired } from 'tc-accounts'; +import { isTokenExpired } from 'tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import { tc } from 'topcoder-react-lib'; From a39e6a5a41c7324057170fe46b61cff66b43c58c Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 8 Sep 2020 18:32:56 +0530 Subject: [PATCH 05/23] fixing yml issue --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f98f1a1084..fc46543324 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ workflows: only: - feature-contentful - hot-fix - - feature/auth0-RS256-Idtoken + - "feature/auth0-RS256-Idtoken" # This is alternate dev env for parallel testing - "build-qa": context : org-global From 378bf27fea21a7ed6531e68a9ce62b7a6f027cd6 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Tue, 8 Sep 2020 18:40:11 +0530 Subject: [PATCH 06/23] fixing yml issue --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc46543324..2f07684bdc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ workflows: only: - feature-contentful - hot-fix - - "feature/auth0-RS256-Idtoken" + - feature/auth0-RS256-Idtoken # This is alternate dev env for parallel testing - "build-qa": context : org-global From 6d48664e5a830cd1348f7a0eb036ef2971ca4270 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 10:57:06 +0530 Subject: [PATCH 07/23] deploying after fixing lodash issue --- .circleci/config.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f07684bdc..a343bd7998 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,6 @@ workflows: only: - feature-contentful - hot-fix - - feature/auth0-RS256-Idtoken # This is alternate dev env for parallel testing - "build-qa": context : org-global @@ -247,6 +246,7 @@ workflows: branches: only: - hot-fix + - feature/auth0-RS256-Idtoken # This is beta env for production soft releases - "build-prod-beta": context : org-global diff --git a/package.json b/package.json index d44fbbc9a3..eb813abc3f 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#master", + "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#div", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.3", From 5a4fe97ff8bab1999ff382a1733771f14d227e74 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 11:06:32 +0530 Subject: [PATCH 08/23] typo --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb813abc3f..8614c28c13 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#div", + "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.3", From 599b2363f2c720c324aaaef81a7a0303a600cbb1 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 13:57:26 +0530 Subject: [PATCH 09/23] changing auth url --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index e28c1030a2..4731b7a42f 100644 --- a/config/default.js +++ b/config/default.js @@ -114,7 +114,7 @@ module.exports = { COMMUNITY_APP: 'https://community-app.topcoder-dev.com', ARENA: 'https://arena.topcoder-dev.com', - AUTH: 'http://accounts.topcoder-dev.com', + AUTH: 'http://accounts-auth0.topcoder-dev.com', BASE: 'https://www.topcoder-dev.com', HOME: '/my-dashboard', BLOG: 'https://www.topcoder-dev.com/blog', From 59b480019ff8e462295352bcc2c43609ab78e136 Mon Sep 17 00:00:00 2001 From: Sachin Maheshwari Date: Wed, 9 Sep 2020 14:52:22 +0530 Subject: [PATCH 10/23] fixing unit test --- __tests__/shared/components/tc-communities/Footer.jsx | 8 ++++---- .../tc-communities/__snapshots__/AccessDenied.jsx.snap | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/__tests__/shared/components/tc-communities/Footer.jsx b/__tests__/shared/components/tc-communities/Footer.jsx index 4145cb1dfe..4af4808c33 100644 --- a/__tests__/shared/components/tc-communities/Footer.jsx +++ b/__tests__/shared/components/tc-communities/Footer.jsx @@ -41,8 +41,8 @@ test('render properly', () => { )); @@ -63,8 +63,8 @@ test('render properly', () => { url: 'leaderboard', }]} communityId="wipro" - registerUrl="https://accounts.topcoder-dev.com/member/registration" - loginUrl="https://accounts.topcoder-dev.com/member" + registerUrl="https://accounts-auth0.topcoder-dev.com/member/registration" + loginUrl="https://accounts-auth0.topcoder-dev.com/member" isAuthorized={false} theme={{ container: 'container', diff --git a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap index 407702adeb..fd1738a2b8 100644 --- a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap +++ b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap @@ -20,7 +20,7 @@ exports[`Matches shallow shapshot 1`] = ` > Log In Here From 4119aca54e3adec7a27f5818d96600e333bc85f4 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Fri, 18 Sep 2020 11:32:15 +0530 Subject: [PATCH 11/23] ci: deploying to stage and dev envs --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e732204bfc..785062d248 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -230,7 +230,7 @@ workflows: filters: branches: only: - - milestone-20200924 + - feature/auth0-RS256-Idtoken - develop # This is alternate dev env for parallel testing - "build-test": @@ -247,7 +247,6 @@ workflows: branches: only: - hot-fix - - feature/auth0-RS256-Idtoken - community-app-tests-poc # This is beta env for production soft releases - "build-prod-beta": @@ -264,6 +263,7 @@ workflows: branches: only: - develop + - feature/auth0-RS256-Idtoken # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration From ca7459ead9c06c7cbc32dbeb9cab8eed15b1ceb6 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Fri, 18 Sep 2020 09:27:50 -0300 Subject: [PATCH 12/23] Remove reauth from Frontend --- config/default.js | 10 ---------- src/client/index.jsx | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/config/default.js b/config/default.js index bd492b5fe5..7a13130ea4 100644 --- a/config/default.js +++ b/config/default.js @@ -78,16 +78,6 @@ module.exports = { }, }, - /* Amount of time [seconds] before expiration of authentication tokens, - * when the frontend will automatically trigger their refreshment. Once - * ready, it will either write to the Redux store fresh token, or will - * remove auth tokens from the store. - * NOTE: With the current implementation of accounts-app this value must be - * smaller than 60 seconds (earlier than 60 seconds before expiration of an - * auth token, a call to the getFreshToken() method returns the old token, - * due to caching). */ - REAUTH_TIME: 55, - /* API key for Segment.io. For development environment the value is set inside * development.json, for production environment it is set via CircleCI * variables. */ diff --git a/src/client/index.jsx b/src/client/index.jsx index 62f6f7063d..fa47d92f3d 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -107,17 +107,6 @@ function authenticate(store) { store.dispatch(actions.direct.dropAll()); store.dispatch(actions.groups.dropGroups()); } - - /* Automatic refreshment of auth tokens. */ - let time = Number.MAX_VALUE; - if (tctV2) time = decodeToken(tctV2).exp; - if (userV3) time = Math.min(time, userV3.exp); - if (time < Number.MAX_VALUE) { - time = 1000 * (time - window.CONFIG.REAUTH_TIME); - time = Math.max(0, time - Date.now()); - logger.log('Reauth scheduled in', time / 1000, 'seconds'); - setTimeout(() => authenticate(store), time); - } }); } From e84f2cffbbaab1ef6a439eb28349e9a14bf60495 Mon Sep 17 00:00:00 2001 From: Sushil Shinde Date: Tue, 22 Sep 2020 14:06:16 +0530 Subject: [PATCH 13/23] fix: prod auth0 domain url --- config/production.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/production.js b/config/production.js index 405c90e93b..0d00edd90e 100644 --- a/config/production.js +++ b/config/production.js @@ -39,7 +39,7 @@ module.exports = { IOS: 'https://ios.topcoder.com', /* Connector URL of the TC accounts App. */ - ACCOUNTS_APP_CONNECTOR: 'https://accounts.topcoder.com/connector.html', + ACCOUNTS_APP_CONNECTOR: 'https://accounts-auth0.topcoder.com/', TCO17: 'https://tco17.topcoder.com/', TOPGEAR: 'https://topgear-app.wipro.com', From db61f478d08c8c5d6f80f1baaf50be6b70fc29b1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 06:08:42 -0300 Subject: [PATCH 14/23] Re added refresh token to community-app --- src/client/index.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client/index.jsx b/src/client/index.jsx index fa47d92f3d..39af362f28 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -107,6 +107,16 @@ function authenticate(store) { store.dispatch(actions.direct.dropAll()); store.dispatch(actions.groups.dropGroups()); } + + /* Automatic refreshment of auth tokens. */ + let time = Number.MAX_VALUE; + if (tctV2) time = decodeToken(tctV2).exp; + if (userV3) time = Math.min(time, userV3.exp); + if (time < Number.MAX_VALUE) { + time = Math.max(1000, (time * 1000) - Date.now()); + logger.log('Reauth scheduled in', time / 1000, 'seconds'); + setTimeout(() => authenticate(store), time + 1000); + } }); } From f6e5c5ed70ed9b4edfa416a944cd85684159d52a Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 06:35:47 -0300 Subject: [PATCH 15/23] Fix Prod Auth0 url's --- config/production.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/production.js b/config/production.js index 0d00edd90e..a2c654155e 100644 --- a/config/production.js +++ b/config/production.js @@ -26,7 +26,7 @@ module.exports = { * as a more verbose name for the param. */ COMMUNITY_APP: 'https://community-app.topcoder.com', - AUTH: 'https://accounts.topcoder.com', + AUTH: 'http://accounts-auth0.topcoder.com', BASE: 'https://www.topcoder.com', HOME: '/my-dashboard', COMMUNITY: 'https://community.topcoder.com', @@ -184,8 +184,8 @@ module.exports = { ], HEADER_MENU_THEME: 'light', HEADER_AUTH_URLS: { - href: 'https://accounts.topcoder.com/member/registration?utm_source=community-app-main', - location: 'https://accounts.topcoder.com/member?retUrl=%S&utm_source=community-app-main', + href: 'https://accounts-auth0.topcoder.com?utm_source=community-app-main', + location: 'https://accounts-auth0.topcoder.com?retUrl=%S&utm_source=community-app-main', }, ACCOUNT_MENU: [ { From ac734d744a0d0ca2fb0782750f18a260df0d7b3f Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Tue, 22 Sep 2020 10:39:42 -0300 Subject: [PATCH 16/23] Fix https to Auth --- config/production.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/production.js b/config/production.js index a2c654155e..f8c8e7ccae 100644 --- a/config/production.js +++ b/config/production.js @@ -26,7 +26,7 @@ module.exports = { * as a more verbose name for the param. */ COMMUNITY_APP: 'https://community-app.topcoder.com', - AUTH: 'http://accounts-auth0.topcoder.com', + AUTH: 'https://accounts-auth0.topcoder.com', BASE: 'https://www.topcoder.com', HOME: '/my-dashboard', COMMUNITY: 'https://community.topcoder.com', From 95c327c5a3c7a3b804faa9d8aaee89961a2a7e69 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 10:56:41 -0300 Subject: [PATCH 17/23] Fix URL.AUTH https to Dev --- config/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.js b/config/default.js index 7a13130ea4..9e0dc95422 100644 --- a/config/default.js +++ b/config/default.js @@ -104,7 +104,7 @@ module.exports = { COMMUNITY_APP: 'https://community-app.topcoder-dev.com', ARENA: 'https://arena.topcoder-dev.com', - AUTH: 'http://accounts-auth0.topcoder-dev.com', + AUTH: 'https://accounts-auth0.topcoder-dev.com', BASE: 'https://www.topcoder-dev.com', HOME: '/my-dashboard', BLOG: 'https://www.topcoder-dev.com/blog', From dcc3aa1a3776d156ea559cc18cd0b688ac886893 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Tue, 22 Sep 2020 11:04:56 -0300 Subject: [PATCH 18/23] Fix snapshot --- .../tc-communities/__snapshots__/AccessDenied.jsx.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap index fd1738a2b8..389cd6e649 100644 --- a/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap +++ b/__tests__/shared/components/tc-communities/__snapshots__/AccessDenied.jsx.snap @@ -20,7 +20,7 @@ exports[`Matches shallow shapshot 1`] = ` > Log In Here From 5970c2135fc6d0c8b42f7e4d6bd31c1734ea7e4d Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 30 Sep 2020 10:52:58 -0300 Subject: [PATCH 19/23] Updated tc-auth-lib name --- package.json | 2 +- src/client/index.jsx | 2 +- src/shared/actions/challenge-listing/index.js | 2 +- src/shared/components/challenge-detail/MySubmissions/index.jsx | 2 +- src/shared/components/challenge-detail/Submissions/index.jsx | 2 +- src/shared/containers/Dashboard/index.jsx | 2 +- src/shared/containers/Settings.jsx | 2 +- src/shared/reducers/tc-communities/index.js | 2 +- src/shared/utils/tc.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index dda4a674af..a0c732f77b 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ }, "dependencies": { "@hapi/joi": "^16.1.4", + "@topcoder-platform/tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.1", "aos": "^2.3.4", "atob": "^2.1.1", "babel-register": "^6.26.0", @@ -134,7 +135,6 @@ "showdown": "^1.8.6", "slick-carousel": "^1.8.1", "supertest": "^3.1.0", - "tc-auth-lib": "git+https://github.com/topcoder-platform/tc-auth-lib.git#dev", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", "topcoder-react-lib": "1.0.5", diff --git a/src/client/index.jsx b/src/client/index.jsx index 39af362f28..b44745e76e 100644 --- a/src/client/index.jsx +++ b/src/client/index.jsx @@ -11,7 +11,7 @@ import { configureConnector, decodeToken, getFreshToken, -} from 'tc-auth-lib'; +} from '@topcoder-platform/tc-auth-lib'; import { actions, logger, errors } from 'topcoder-react-lib'; import { client, redux } from 'topcoder-react-utils'; diff --git a/src/shared/actions/challenge-listing/index.js b/src/shared/actions/challenge-listing/index.js index c03710a480..2e0ac3e5cd 100644 --- a/src/shared/actions/challenge-listing/index.js +++ b/src/shared/actions/challenge-listing/index.js @@ -4,7 +4,7 @@ import _ from 'lodash'; import { createActions } from 'redux-actions'; -import { decodeToken } from 'tc-auth-lib'; +import { decodeToken } from '@topcoder-platform/tc-auth-lib'; import 'isomorphic-fetch'; import { processSRM } from 'utils/tc'; import { errors, services } from 'topcoder-react-lib'; diff --git a/src/shared/components/challenge-detail/MySubmissions/index.jsx b/src/shared/components/challenge-detail/MySubmissions/index.jsx index a450dd32cf..824b29d0d6 100644 --- a/src/shared/components/challenge-detail/MySubmissions/index.jsx +++ b/src/shared/components/challenge-detail/MySubmissions/index.jsx @@ -7,7 +7,7 @@ import PT from 'prop-types'; import _ from 'lodash'; import { goToLogin } from 'utils/tc'; import LoadingIndicator from 'components/LoadingIndicator'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import SubmissionsList from './SubmissionsList'; import SubmissionsDetail from './SubmissionsDetail'; diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index f3ead12c3f..380e3cf9ac 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -11,7 +11,7 @@ import _ from 'lodash'; import { connect } from 'react-redux'; import { config } from 'topcoder-react-utils'; import { submission as submissionUtils } from 'topcoder-react-lib'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import cn from 'classnames'; import { PrimaryButton } from 'topcoder-react-ui-kit'; diff --git a/src/shared/containers/Dashboard/index.jsx b/src/shared/containers/Dashboard/index.jsx index 6e4cd40ad3..915e98ac74 100644 --- a/src/shared/containers/Dashboard/index.jsx +++ b/src/shared/containers/Dashboard/index.jsx @@ -25,7 +25,7 @@ import { updateChallengeType } from 'utils/challenge'; import challengeListingActions from 'actions/challenge-listing'; import communityActions from 'actions/tc-communities'; -import { isTokenExpired, decodeToken } from 'tc-auth-lib'; +import { isTokenExpired, decodeToken } from '@topcoder-platform/tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import './styles.scss'; diff --git a/src/shared/containers/Settings.jsx b/src/shared/containers/Settings.jsx index 1d43a99cb0..dcbaf86ad0 100644 --- a/src/shared/containers/Settings.jsx +++ b/src/shared/containers/Settings.jsx @@ -6,7 +6,7 @@ import React from 'react'; import PT from 'prop-types'; import { connect } from 'react-redux'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import { goToLogin } from 'utils/tc'; import { actions } from 'topcoder-react-lib'; diff --git a/src/shared/reducers/tc-communities/index.js b/src/shared/reducers/tc-communities/index.js index c7db77ae7f..5ab21acf3d 100644 --- a/src/shared/reducers/tc-communities/index.js +++ b/src/shared/reducers/tc-communities/index.js @@ -8,7 +8,7 @@ import _ from 'lodash'; import actions from 'actions/tc-communities'; import { logger, services, errors } from 'topcoder-react-lib'; import { handleActions } from 'redux-actions'; -import { decodeToken } from 'tc-auth-lib'; +import { decodeToken } from '@topcoder-platform/tc-auth-lib'; import { getAuthTokens } from 'utils/tc'; import { STATE as JOIN_COMMUNITY } from 'components/tc-communities/JoinCommunity'; import { getCommunityId } from 'server/services/communities'; diff --git a/src/shared/utils/tc.js b/src/shared/utils/tc.js index 8aff2c8620..305b783cad 100644 --- a/src/shared/utils/tc.js +++ b/src/shared/utils/tc.js @@ -5,7 +5,7 @@ import _ from 'lodash'; import moment from 'moment-timezone'; -import { isTokenExpired } from 'tc-auth-lib'; +import { isTokenExpired } from '@topcoder-platform/tc-auth-lib'; import { config, isomorphy } from 'topcoder-react-utils'; import { tc } from 'topcoder-react-lib'; From 630e97cf556394673c0f114a51ea0116ae9b0cd7 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 30 Sep 2020 11:30:34 -0300 Subject: [PATCH 20/23] Change tc-auth-lib name --- __tests__/client/client.jsx | 2 +- __tests__/shared/reducers/auth.js | 2 +- __tests__/shared/reducers/challenge.js | 2 +- src/shared/containers/EmailVerification/index.jsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__tests__/client/client.jsx b/__tests__/client/client.jsx index f76a304068..84e6e19b26 100644 --- a/__tests__/client/client.jsx +++ b/__tests__/client/client.jsx @@ -106,7 +106,7 @@ const mockTcAccounts = { decodeToken: () => ({ exp: Date.now() }), getFreshToken: () => Promise.resolve(tokenV3), }; -jest.setMock('tc-auth-lib', mockTcAccounts); +jest.setMock('@topcoder-platform/tc-auth-lib', mockTcAccounts); /* Mock auth actions */ /* diff --git a/__tests__/shared/reducers/auth.js b/__tests__/shared/reducers/auth.js index d6c9f923bc..85ae05645f 100644 --- a/__tests__/shared/reducers/auth.js +++ b/__tests__/shared/reducers/auth.js @@ -24,7 +24,7 @@ const mockActions = { _.merge(actions, mockActions); -jest.setMock('tc-auth-lib', { +jest.setMock('@topcoder-platform/tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/__tests__/shared/reducers/challenge.js b/__tests__/shared/reducers/challenge.js index a65d45fea6..2d4e112a9d 100644 --- a/__tests__/shared/reducers/challenge.js +++ b/__tests__/shared/reducers/challenge.js @@ -11,7 +11,7 @@ import { mock, actions } from 'topcoder-react-lib'; const { mockAction } = mock; -jest.setMock('tc-auth-lib', { +jest.setMock('@topcoder-platform/tc-auth-lib', { decodeToken: () => 'User object', isTokenExpired: () => false, }); diff --git a/src/shared/containers/EmailVerification/index.jsx b/src/shared/containers/EmailVerification/index.jsx index eee56a96e5..e425db7c5a 100644 --- a/src/shared/containers/EmailVerification/index.jsx +++ b/src/shared/containers/EmailVerification/index.jsx @@ -8,7 +8,7 @@ import PT from 'prop-types'; import {connect} from "react-redux"; import { actions } from "topcoder-react-lib"; import { Redirect } from 'react-router'; -import {isTokenExpired} from "tc-auth-lib"; +import {isTokenExpired} from '@topcoder-platform/tc-auth-lib'; import * as queryString from 'query-string'; import LoadingIndicator from 'components/LoadingIndicator'; import Error404 from 'components/Error404'; From 4a97b205a5d0f59310188591b4fb1b9c5ce935b1 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Thu, 1 Oct 2020 21:28:19 -0300 Subject: [PATCH 21/23] Added @topcoder to babel transform ignore --- bin/www | 2 +- config/jest/default.js | 2 +- config/webpack/development.js | 2 +- config/webpack/production.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/www b/bin/www index 0ed62f7ba6..ef2d8722eb 100644 --- a/bin/www +++ b/bin/www @@ -5,7 +5,7 @@ /* Enables Babel for the server-side code (with exception of this very file). */ require('babel-register')({ ignore: [ - /node_modules\/(?!appirio-tech.*|topcoder|tc-)/, + /node_modules\/(?!appirio-tech.*|topcoder|tc-|@topcoder)/, /node_modules\/topcoder-react-utils/, ], }); diff --git a/config/jest/default.js b/config/jest/default.js index bcf9b8d5af..bc35369eba 100644 --- a/config/jest/default.js +++ b/config/jest/default.js @@ -1,7 +1,7 @@ const config = require('topcoder-react-utils/config/jest/default'); const nodeConfig = require('config'); -config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-)'; +config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-|@topcoder)'; // Include the directories whose tests has been written to minimize coverage time config.collectCoverageFrom = ['src/client/*.{js,jsx}', 'src/server/*.{js,jsx}', 'src/shared/*.{js,jsx}']; diff --git a/config/webpack/development.js b/config/webpack/development.js index a7b910a4d3..bc853989aa 100644 --- a/config/webpack/development.js +++ b/config/webpack/development.js @@ -17,7 +17,7 @@ const standardDevelopmentConfig = configFactory({ const jsxRule = standardDevelopmentConfig.module.rules.find(rule => rule.loader === 'babel-loader'); jsxRule.exclude = [ - /node_modules[\\/](?!appirio-tech.*|topcoder|tc-)/, + /node_modules[\\/](?!appirio-tech.*|topcoder|tc-|@topcoder)/, /src[\\/]assets[\\/]fonts/, /src[\\/]assets[\\/]images[\\/]dashboard/, ]; diff --git a/config/webpack/production.js b/config/webpack/production.js index 4023147b4d..ab95dbac37 100644 --- a/config/webpack/production.js +++ b/config/webpack/production.js @@ -24,7 +24,7 @@ const standardDevelopmentConfig = configFactory({ const jsxRule = standardDevelopmentConfig.module.rules.find(rule => rule.loader === 'babel-loader'); jsxRule.exclude = [ - /node_modules[\\/](?!appirio-tech.*|topcoder|tc-)/, + /node_modules[\\/](?!appirio-tech.*|topcoder|tc-|@topcoder)/, /src[\\/]assets[\\/]fonts/, /src[\\/]assets[\\/]images[\\/]dashboard/, ]; From c853a0cf00a596c987dd9514341cdcee253d58bf Mon Sep 17 00:00:00 2001 From: Luiz Ricardo Rodrigues Date: Tue, 13 Oct 2020 06:53:24 -0300 Subject: [PATCH 22/23] fix: for issue #4937 Issue: https://github.com/topcoder-platform/community-app/issues/4937 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4304fb6162..e53002d583 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "supertest": "^3.1.0", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.24.6", + "topcoder-react-lib": "1000.23.1", "topcoder-react-ui-kit": "2.0.1", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", From 862c04449df4824a461a0451417fbd8cde2187a9 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Wed, 14 Oct 2020 03:19:51 -0300 Subject: [PATCH 23/23] Updated footer Join Community link to new Auth0 --- .../shared/components/__snapshots__/TopcoderFooter.jsx.snap | 2 +- src/shared/components/TopcoderFooter/index.jsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap b/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap index 387a544a65..c7007eef45 100644 --- a/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap +++ b/__tests__/shared/components/__snapshots__/TopcoderFooter.jsx.snap @@ -316,7 +316,7 @@ exports[`Matches shallow shapshot 1`] = ` className="src-shared-components-TopcoderFooter-___style__link___3-nzm" > Join Community diff --git a/src/shared/components/TopcoderFooter/index.jsx b/src/shared/components/TopcoderFooter/index.jsx index 1910102404..587153bd65 100644 --- a/src/shared/components/TopcoderFooter/index.jsx +++ b/src/shared/components/TopcoderFooter/index.jsx @@ -2,7 +2,7 @@ import moment from 'moment'; import PT from 'prop-types'; import React from 'react'; -import { config } from 'topcoder-react-utils'; +import { config, isomorphy } from 'topcoder-react-utils'; import FacebookIcon from './icons/icon-fb.svg'; import YouTubeIcon from './icons/icon-youtube.svg'; @@ -33,6 +33,8 @@ Link.propTypes = { export default function TopcoderFooter() { const base = config.URL.BASE; + const auth = config.URL.AUTH; + const retUrl = isomorphy.isClientSide() ? encodeURIComponent(window.location.href) : ''; const currentYear = moment().year(); return (
@@ -90,7 +92,7 @@ export default function TopcoderFooter() {
    Admins Contact Us - Join Community + Join Community About Community Changelog Talk to Sales