Repository navigation
refactor(common): auth and the Rust SDK name the Bearer scheme through one AuthScheme - #680
Draft
PiquelChips wants to merge 2 commits into
Draft
PiquelChips wants to merge 2 commits into
PiquelChips wants to merge 2 commits into
Conversation
…h one AuthScheme Auth's `AuthScheme` moves unchanged to `sourceorigin_common::protocol::challenge`, with `matches` for the case-insensitive comparison. Challenges, auth's `Authorization` parsing and the Rust SDK's bearer layer and token-response check all spell and compare the scheme through it.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
… say how to compare a header's scheme
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.
Part of #544
"Bearer" and the rule that scheme names are case-insensitive were written four times: auth's private
oidc::AuthScheme, common'sSCHEMEconstant for challenges, and twoeq_ignore_ascii_case("Bearer")calls in the Rust SDK (its bearer layer and its token-response check).AuthSchememoves, unchanged, from auth tosourceorigin_common::protocol::challenge, withmatches, the case-insensitive comparison, besidecredentials. Challenges format and findBearerthrough it, auth readsBasicandBearercredentials with it as before, and the SDK compares the scheme of anAuthorizationheader and a token response'stoken_typewith it.The SDK keeps its own split of an
Authorizationheader: it trims the credentials on both sides and reads a bareBeareras malformed, wherecredentialskeeps trailing characters and reads a bareBeareras no credentials, so sharing that too would change a response.Tests
authentication_schemes_are_case_insensitiveandauthentication_schemes_allow_several_spacesmove, unchanged, fromapps/auth-service/src/oidc/tests/protocol.rstocrates/common/src/protocol/challenge/tests.rs, beside the code they test.Unchanged
"Bearer"/"Basic", and each comparison stays ASCII case-insensitive;credentialsmoved verbatim.cargo semver-checksonsourceorigin-commonandsourceorigin-authagainstorigin/main(all features): no semver update required for either.AuthSchemeis a new public item ofsourceorigin-common.Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)