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

Add auto_error parameter and fix authorization bug #63

Merged
merged 5 commits into from
Jun 7, 2024

Conversation

torkashvand
Copy link
Contributor

@torkashvand torkashvand commented Jun 6, 2024

Description:
When is_bypassable_request decides to bypass a request for any reason, it sends None to the authorize function in the Authorization classes. This causes a bug because the authorize function expects a user as a dict.

I also made the authenticate function more explicit about the id_token_extractor. It used to raise an exception when it couldn't find a token in the header. I removed the line that returned None after this, as it wasn't necessary.
The function is already set to raise an exception when it can't find a token, so that code wasn't needed.

Changes Made

  • Added auto_error parameter to the extract method in IdTokenExtractor.
  • Updated HttpBearerExtractor to use the auto_error parameter.
  • Fixed bug where bypassable requests sent None to the authorize function, causing authorization failures.
  • Made the authenticate method explicit about id_token_extractor and removed unnecessary lines that returned None.

- Added `auto_error` parameter to the `extract` method in `IdTokenExtractor`.
- Updated `HttpBearerExtractor` to use the `auto_error` parameter.
- Fixed bug where bypassable requests sent `None` to the `authorize` function, causing authorization failures.
- Made `authenticate` method more explicit about `id_token_extractor` and removed unnecessary line that returned `None`.
@torkashvand torkashvand requested a review from Mark90 June 6, 2024 11:20
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.63%. Comparing base (79097ec) to head (3fe3bfa).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #63      +/-   ##
==========================================
+ Coverage   87.05%   87.63%   +0.58%     
==========================================
  Files           5        5              
  Lines         363      364       +1     
  Branches       32       32              
==========================================
+ Hits          316      319       +3     
+ Misses         34       33       -1     
+ Partials       13       12       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@torkashvand torkashvand force-pushed the fix/auto_error-and-bypassable-request-bug branch from bb15218 to adee789 Compare June 6, 2024 15:28
@Mark90 Mark90 merged commit 7b8020a into master Jun 7, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants