Skip to content

Commit

Permalink
Added disconnect redirect URL to disconnect function signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Dec 15, 2017
1 parent b3c1f3c commit dec858f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/authnz/__init__.py
Expand Up @@ -71,7 +71,7 @@ def callback(self, state_token, authz_code, trans):
"""
raise NotImplementedError()

def disconnect(self, provider, trans):
def disconnect(self, provider, trans, redirect_url=None):
raise NotImplementedError()


Expand Down Expand Up @@ -179,5 +179,5 @@ def callback(self, provider, state_token, authz_code, trans):
else:
raise NameError("The provider '{}' is not a recognized and expected provider.".format(provider))

def disconnect(self, provider, trans):
return self.providers[provider].disconnect(provider, trans)
def disconnect(self, provider, trans, redirect_url=None):
return self.providers[provider].disconnect(provider, trans, redirect_url)
5 changes: 2 additions & 3 deletions lib/galaxy/authnz/psa_authnz.py
Expand Up @@ -69,8 +69,6 @@ def _parse_config(self, provider, oidc_rp_config, config_xml):
if provider == 'google':
self._parse_google_config(config_xml)

config[setting_name('DISCONNECT_REDIRECT_URL')] = ()

# The following config sets PSA to call the `login_user` function for
# logging in a user. If this setting is set to false, the `login_user`
# would not be called, and as a result Galaxy would not know who is
Expand Down Expand Up @@ -170,12 +168,13 @@ def callback(self, state_token, authz_code, trans):
redirect_url = do_complete(self.backend, login=lambda backend, user, social_user: self.login_user(user), user=self.get_current_user(trans), state=state_token)
return redirect_url, self.strategy.session_get('user', None)

def disconnect(self, provider, trans, association_id=None):
def disconnect(self, provider, trans, redirect_url=None, association_id=None):
_trans = trans
self._on_the_fly_config(trans)
backend_label = 'google-openidconnect'
uri = '/authn/{provider}/callback' # TODO find a better of doing this -- this info should be passed from buildapp.py

config[setting_name('DISCONNECT_REDIRECT_URL')] = redirect_url if redirect_url is not None else ()
self.strategy = Strategy(trans, Storage) # self.load_strategy()
# the following line is temporary, find a better solution.
self.backend = self.load_backend(self.strategy, backend_label, uri)
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/authn.py
Expand Up @@ -31,4 +31,4 @@ def disconnect(self, trans, **kwargs):
if trans.user is None:
# Only logged in users are allowed here.
return
return trans.response.send_redirect(trans.app.authnz_manager.disconnect('Google', trans))
return trans.response.send_redirect(trans.app.authnz_manager.disconnect('Google', trans, redirect_url=None))

0 comments on commit dec858f

Please sign in to comment.