diff --git a/src/tab-manager/__tests__/redirect.test.js b/src/tab-manager/__tests__/redirect.test.js index 016154dd..e96e4f5a 100644 --- a/src/tab-manager/__tests__/redirect.test.js +++ b/src/tab-manager/__tests__/redirect.test.js @@ -44,6 +44,24 @@ describe('Tab Manager Redirect module test suite', () => { // Then expect(result).toBe(false); }); + describe('Eclipse Chat OAuth', () => { + test('From chat.eclipse.org to matrix auth, should return false', () => { + // Given + mockViewUrl = 'https://chat.eclipse.org'; + // When + const result = redirect.shouldOpenInExternalBrowser(mockView, new URL('https://matrix.eclipse.org/_matrix/client/v3/login/sso/redirect/oidc-oauth2_eclipse?redirectUrl=https%3A%2F%2Fchat.eclipse.org%2F&org.matrix.msc3824.action=login')); + // Then + expect(result).toBe(false); + }); + test('From matrix.eclipse.org to chat.eclipse.org, should return false', () => { + // Given + mockViewUrl = 'https://matrix.eclipse.org'; + // When + const result = redirect.shouldOpenInExternalBrowser(mockView, new URL('https://chat.eclipse.org/?loginToken=syl_gLnNMaZoSqyWuCiPkuQr_1dWSvb')); + // Then + expect(result).toBe(false); + }); + }); describe('Google OAuth', () => { test('From OAuth to Slack, should return false', () => { // Given diff --git a/src/tab-manager/redirect.js b/src/tab-manager/redirect.js index 3d8c7fb5..393304f2 100644 --- a/src/tab-manager/redirect.js +++ b/src/tab-manager/redirect.js @@ -19,6 +19,8 @@ const matchUrls = regexList => (viewUrl, url) => regexList.some(regex => viewUrl.href.match(regex) || url.href.match(regex)); const isOAuth = matchUrls([ + /^https:\/\/chat.eclipse.org\/\?loginToken.*/, // NOSONAR + /^https:\/\/matrix.eclipse.org\/.+\/login\/sso\/.*/, // NOSONAR /^https:\/\/(.+\.)?github\.com\/login\/oauth.*/, // NOSONAR /^https:\/\/sso\.godaddy\.com\/.*/, // NOSONAR /^https:\/\/.+\.google\.com\/o\/oauth2\/.*/, // NOSONAR