raelgc / scudcloud

ScudCloud - Slack for Linux
https://launchpad.net/~rael-gc/+archive/ubuntu/scudcloud
MIT License
1.22k stars 99 forks source link

Not working with Auth0 SAML #614

Open callahad opened 6 years ago

callahad commented 6 years ago

Follow-on to #44 and #185.

ScudCloud 1.65 opens the SAML authentication link in a new browser window instead of continuing in-app for Slack teams using Auth0.

Steps to reproduce

  1. Attempt to authenticate to mozilla.slack.com in ScudCloud
  2. Click "Sign in with Auth0"

Expected behavior

  1. Authentication continues in ScudCloud

Actual behavior

  1. Authentication opens in a new browser window, making it impossible to log in with ScudCloud

Root Cause

The SAML URL does not have a ?redir=... query parameter, so it fails to match SSO_URL_RE: https://github.com/raelgc/scudcloud/blob/e8f246a1e63169527b1ddec18850de0e5d7ca1ee/scudcloud/resources.py#L11

Possible Solution

Shorten the regex to not examine the URL's query string:

diff --git a/scudcloud/resources.py b/scudcloud/resources.py
index eff107b..b946d31 100644
--- a/scudcloud/resources.py
+++ b/scudcloud/resources.py
@@ -8,7 +8,7 @@ class Resources:
     SIGNIN_URL = 'https://slack.com/signin'
     MAINPAGE_URL_RE = re.compile(r'^http[s]://[a-zA-Z0-9_\-]+.slack.com/?$')
     MESSAGES_URL_RE = re.compile(r'^http[s]://[a-zA-Z0-9_\-]+.slack.com/messages/.*')
-    SSO_URL_RE = re.compile(r'^http[s]://[a-zA-Z0-9_\-]+.(enterprise.)?slack.com/sso/saml/start\?redir=.*')
+    SSO_URL_RE = re.compile(r'^http[s]://[a-zA-Z0-9_\-]+.(enterprise.)?slack.com/sso/saml/start')
     SERVICES_URL_RE = re.compile(r'^http[s]://[a-zA-Z0-9_\-]+.(enterprise.)?slack.com/services/.*')
     GOOGLE_OAUTH2_URL_RE = re.compile(r'^https://accounts.google.com/o/oauth')

(Worked for me, at least)

raelgc commented 6 years ago

Hi @callahad and thanks for reporting this!

Do you mind to create a pull request with those changes?