Skip to content

Commit

Permalink
🐛 support for chat.eclipse.org + matrix.eclipse.org (#417)
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored May 30, 2024
1 parent d26e27c commit 81082b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/tab-manager/__tests__/redirect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/tab-manager/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 81082b0

Please sign in to comment.