Merge pull request #7592 from VJalili/fix_index_api_2

Format authnz-related api responses as JSON objects.
This commit is contained in:
Dannon
2019-03-25 15:03:45 -04:00
committed by GitHub
@@ -4,7 +4,6 @@ OAuth 2.0 and OpenID Connect Authentication and Authorization Controller.
from __future__ import absolute_import
import json
import logging
from galaxy import exceptions
@@ -17,6 +16,7 @@ log = logging.getLogger(__name__)
class OIDC(JSAppLauncher):
@web.json
@web.expose
@web.require_login("list third-party identities")
def index(self, trans, **kwargs):
@@ -37,6 +37,7 @@ class OIDC(JSAppLauncher):
rtv.append({'id': trans.app.security.encode_id(authnz.id), 'provider': authnz.provider})
return rtv
@web.json
@web.expose
def login(self, trans, provider):
if not trans.app.config.enable_oidc:
@@ -45,7 +46,7 @@ class OIDC(JSAppLauncher):
return trans.show_error_message(msg)
success, message, redirect_uri = trans.app.authnz_manager.authenticate(provider, trans)
if success:
return json.dumps({"redirect_uri": redirect_uri})
return {"redirect_uri": redirect_uri}
else:
raise exceptions.AuthenticationFailed(message)