Implement http bearer token auth#42
Open
DanLipsitt wants to merge 2 commits intopython-lapidary:developfrom
Open
Implement http bearer token auth#42DanLipsitt wants to merge 2 commits intopython-lapidary:developfrom
DanLipsitt wants to merge 2 commits intopython-lapidary:developfrom
Conversation
DanLipsitt
commented
Jan 17, 2026
tests/e2e/render/expected/dummy/src/test_dummy/components/securitySchemes.py
Show resolved
Hide resolved
Contributor
|
Thank you for the contribution. Yeah, OAS has many funny corner cases which are best handled case-by-case. Wasn't sure if it made sense to have both bearer and oauth2, and I didn't need it, so I left it out. I'm working on some changes to the core lapidary RN, then I'll review this one. Cheers |
| key: str = 'Authorization' | ||
| location: ParamLocation = ParamLocation.HEADER | ||
| format: str | None = 'bearer_token' | ||
| bearer_format: str | None = 'bearer_token' |
Contributor
There was a problem hiding this comment.
What's this?
Did you write this code yourself?
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Tests and implementation for standalone http bearer token auth.
Although OAuth2 supports bearer tokens, they are sometimes used without OAuth as a kind of API key. This is what I mean by "standalone." Although it isn't best practice or what is intended by the spec, it doesn't seem uncommon to (mis)use bearer tokens this way. I am dealing with an API that does this, so here is an implementation for Lapidary. It doesn't appear to be explicitly part of
httpxorhttpx_auth, so I did it as a special case ofApiKeyAuth.