Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[T-CAIREM 1243] Hotfix issue with boolean conversion and use string comparison instead #2325

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion physionet-django/physionet/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
ORCID_CLIENT_ID = config('ORCID_CLIENT_ID', default=False)
ORCID_CLIENT_SECRET = config('ORCID_CLIENT_SECRET', default=False)
ORCID_SCOPE = config('ORCID_SCOPE', default=False)
ORCID_LOGIN_ENABLED = config('ORCID_LOGIN_ENABLED', default=False)
ORCID_LOGIN_ENABLED = config('ORCID_LOGIN_ENABLED', default=False, cast=bool)
ORCID_OPEN_ID_JWKS_URL = config('ORCID_OPEN_ID_JWKS_URL', default="https://sandbox.orcid.org/oauth/jwks")
ORCID_LOGIN_BUTTON_TEXT = config('ORCID_LOGIN_BUTTON_TEXT', default="Log in using ORCID iD")

Expand Down
2 changes: 1 addition & 1 deletion physionet-django/user/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def validate_orcid_id_token(token):

rsa_key = public_keys[headers['kid']]
if rsa_key is None:
raise ValidationError('ORCID id_token is invalid.')
raise ValidationError('ORCID public RSA key is None.')

try:
jwt.decode(
Expand Down
3 changes: 2 additions & 1 deletion physionet-django/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ def _fetch_and_validate_token(request, code, oauth_session):
validators.validate_orcid_id_token(token['id_token'])

return True, token
except ValidationError:
except ValidationError as e:
logger.error(f'Validation Error: ORCID token validation failed. Error message: {e.message}')
messages.error(request, 'Validation Error: ORCID token validation failed.')
except InvalidGrantError:
messages.error(
Expand Down
Loading