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

Fix: OAuth exception is not overwritten #2690

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lalver1
Copy link
Member

@lalver1 lalver1 commented Feb 14, 2025

Closes #2643

This PR makes a change so that the original exception associated with a misconfigured ClaimsProvider (such as an invalid authority) is not overwritten and is the one that gets bubbled further.

Reviewing

Use the local_fixtures.json file to populate your database since these fixtures have invalid values for ClaimsProvider.authority. Run through the Older Adult flow and notice that result in Line 71 will not be created (the exception is 404 Client Error: Not Found for url: https://example.com/.well-known/openid-configuration) and thus is still None. Note that this more specific exception is bubbled further instead of authorize_redirect returned None which was the original behavior.

ClaimsProvider (oauth_client.authorize_redirect throws an exception)
is not overwritten and is the one that gets bubbled further.
@lalver1 lalver1 self-assigned this Feb 14, 2025
@github-actions github-actions bot added back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev and removed back-end Django views, sessions, middleware, models, migrations etc. labels Feb 14, 2025
Copy link

github-actions bot commented Feb 14, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/oauth
  views.py
Project Total  

This report was generated by python-coverage-comment-action

@lalver1 lalver1 marked this pull request as ready for review February 14, 2025 18:25
@lalver1 lalver1 requested a review from a team as a code owner February 14, 2025 18:25
Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I would say we should add a test for this.

But since we'll be deleting most of this code as part of #2679, this is fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment-dev [auto] Changes that will trigger a deploy if merged to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OAuth exception is swallowed and overwritten on login
2 participants