Skip to content

Commit

Permalink
Now get IdP names from buildapp/router; previously it was hard-code.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Dec 18, 2017
1 parent cd9783e commit b086802
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/galaxy/webapps/galaxy/controllers/authn.py
Expand Up @@ -14,28 +14,28 @@
class OIDC(BaseUIController):

@web.expose
def login(self, trans, **kwargs):
return trans.response.send_redirect(web.url_for(trans.app.authnz_manager.authenticate("Google", trans)))
def login(self, trans, provider):
return trans.response.send_redirect(web.url_for(trans.app.authnz_manager.authenticate(provider, trans)))

@web.expose
def callback(self, trans, **kwargs):
def callback(self, trans, provider, **kwargs):
if 'error' in kwargs:
# TODO: handle error
print 'kwargs: ', kwargs
raise
#TODO: make the following more generic, the attributes state and code are Google specific.
redirect_url, user = trans.app.authnz_manager.callback("Google", kwargs['state'], kwargs['code'], trans, login_redirect_url=url_for('/'))
redirect_url, user = trans.app.authnz_manager.callback(provider, kwargs['state'], kwargs['code'], trans, login_redirect_url=url_for('/'))
trans.handle_user_login(user)
return trans.response.send_redirect(redirect_url)

@web.expose
@web.require_login("authenticate against Google identity provider")
def disconnect(self, trans, **kwargs):
def disconnect(self, trans, provider, **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, disconnect_redirect_url=url_for('/')))
trans.app.authnz_manager.disconnect(provider, trans, disconnect_redirect_url=url_for('/')))

# TODO: check for the error: AuthAlreadyAssociated: This google-openidconnect account is already in use.
# it happens when authenticating a user whose previous authentication was disconnected.

0 comments on commit b086802

Please sign in to comment.