Skip to content

Commit

Permalink
Redirect user to main page after a successful authentication.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Dec 14, 2017
1 parent 61bbdde commit e290fea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/authnz/psa_authnz.py
@@ -1,6 +1,8 @@
from ..authnz import IdentityProvider
from ..model import UserAuthnzToken, PSANonce, PSAAssociation, PSAPartial, PSACode

from galaxy.web import url_for

from social_core.actions import do_auth, do_complete, do_disconnect
from social_core.backends.utils import get_backend
from social_core.strategy import BaseStrategy
Expand Down Expand Up @@ -72,9 +74,6 @@ def _parse_config(self, provider, config_xml):
# TODO: set the following parameter
# config[setting_name('REQUESTS_TIMEOUT')] =

# TODO:
# config[setting_name('SOCIAL_AUTH_LOGIN_REDIRECT_URL')] =

def _parse_google_config(self, config_xml):
config['SOCIAL_AUTH_GOOGLE_OPENIDCONNECT_KEY'] = config_xml.find('client_id').text
config['SOCIAL_AUTH_GOOGLE_OPENIDCONNECT_SECRET'] = config_xml.find('client_secret').text
Expand Down Expand Up @@ -146,6 +145,7 @@ def authenticate(self, trans):
return do_auth(self.backend)

def callback(self, state_token, authz_code, trans):
config[setting_name('LOGIN_REDIRECT_URL')] = url_for('/')
_trans = trans
trans.app.model.PSACode.trans = trans
trans.app.model.UserAuthnzToken.trans = trans
Expand Down
5 changes: 3 additions & 2 deletions lib/galaxy/webapps/galaxy/controllers/authn.py
Expand Up @@ -17,10 +17,11 @@ def login(self, trans, **kwargs):

@web.expose
def callback(self, trans, **kwargs):
if trans.app.authnz_manager.callback("Google", kwargs['state'], kwargs['code'], trans) is False:
return trans.response.send_redirect(trans.app.authnz_manager.callback("Google", kwargs['state'], kwargs['code'], trans))
#if trans.app.authnz_manager.callback("Google", kwargs['state'], kwargs['code'], trans) is False:
# TODO: inform the user why he/she is being re-authenticated.
# self.google_authn(trans) # maybe not needed.
pass
# pass

@web.expose
@web.require_login("authenticate against Google identity provider")
Expand Down

0 comments on commit e290fea

Please sign in to comment.