-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add API key authentication support #2431
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
Merged
dpgaspar
merged 16 commits into
dpgaspar:master
from
aminghadersohi:amin/ch99414/api-key-auth
Mar 1, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
48f7b47
feat: add API key authentication support
aminghadersohi 8bb4d37
fix: apply black formatting to API key auth files
aminghadersohi d76373d
fix: revert to black 23.10 formatting for decorators.py
aminghadersohi 42cee23
fix: remove unused imports in test_api_key.py
aminghadersohi 70ce67b
fix: ensure ApiKey permissions are created when update_perms is False
aminghadersohi 97eb580
feat: add lookup_hash for O(1) key validation, address review feedback
aminghadersohi 2a51dcd
style: apply black formatting to models and manager
aminghadersohi d26206e
fix: use HMAC for lookup hash to resolve CodeQL alerts
aminghadersohi 886933c
fix: remove unused hashlib import, suppress CodeQL false positive
aminghadersohi 2dd738b
fix: use BLAKE2b for lookup hash to resolve CodeQL alerts
aminghadersohi 303a9e4
fix: use scrypt for lookup hash to satisfy CodeQL
aminghadersohi 7b9e649
fix: address PR review - 401 vs 403, public method, OpenAPI spec, docs
aminghadersohi 168ee87
fix: use black 23.10 formatting for decorators.py to pass CI lint
aminghadersohi c1d2c5b
fix: import USERNAME_READONLY in test_api_key to fix lint
aminghadersohi 1bd0860
fix: use no-permission role in 403 test instead of ReadOnly
aminghadersohi 92d7393
fix: clean up noperms_user in tearDown to prevent test pollution
aminghadersohi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from .api import ApiKeyApi # noqa: F401 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's distinguish between a valid key with no authorization from an invalid key:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done -- invalid key now returns
response_401(), and a valid key without permission returnsresponse_403(). Updated the test expectation to match.