From 54a67630fdb846945af081a410bb7e4787987620 Mon Sep 17 00:00:00 2001 From: hadleyking Date: Wed, 19 Jul 2023 10:22:01 -0400 Subject: [PATCH] Fix #134 Changes to be committed: modified: authentication/services.py --- authentication/services.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/authentication/services.py b/authentication/services.py index 65efd482..992a73c2 100644 --- a/authentication/services.py +++ b/authentication/services.py @@ -39,10 +39,12 @@ def authenticate(self, request): user = authenticate_orcid(unverified_payload, token) if unverified_payload['iss'] == 'accounts.google.com': user = authenticate_google(token) - if unverified_payload['iss'] in ['http://localhost:8080', 'https://test.portal.biochemistry.gwu.edu/', 'https://biocomputeobject.org/']: + if unverified_payload['iss'] in ['http://localhost:8080', 'https://test.portal.biochemistry.gwu.edu', 'https://biocomputeobject.org']: user = authenticate_portal(unverified_payload, token) - - return (user, token) + try: + return (user, token) + except UnboundLocalError as exp: + raise exceptions.AuthenticationFailed("Authentication failed. Token issuer not found. Please contact the site admin") if type == 'Token' or type == 'TOKEN': pass