Skip to content

refactor(common): auth and the Rust SDK name the Bearer scheme through one AuthScheme - #680

Draft
PiquelChips wants to merge 2 commits into
mainfrom
refactor/544-boundary-bearer-scheme
Draft

PiquelChips wants to merge 2 commits into
mainfrom
refactor/544-boundary-bearer-scheme

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Part of #544

"Bearer" and the rule that scheme names are case-insensitive were written four times: auth's private oidc::AuthScheme, common's SCHEME constant for challenges, and two eq_ignore_ascii_case("Bearer") calls in the Rust SDK (its bearer layer and its token-response check).

AuthScheme moves, unchanged, from auth to sourceorigin_common::protocol::challenge, with matches, the case-insensitive comparison, beside credentials. Challenges format and find Bearer through it, auth reads Basic and Bearer credentials with it as before, and the SDK compares the scheme of an Authorization header and a token response's token_type with it.

The SDK keeps its own split of an Authorization header: it trims the credentials on both sides and reads a bare Bearer as malformed, where credentials keeps trailing characters and reads a bare Bearer as no credentials, so sharing that too would change a response.

Tests

  • authentication_schemes_are_case_insensitive and authentication_schemes_allow_several_spaces move, unchanged, from apps/auth-service/src/oidc/tests/protocol.rs to crates/common/src/protocol/challenge/tests.rs, beside the code they test.

Unchanged

  • Every spelling is the same "Bearer"/"Basic", and each comparison stays ASCII case-insensitive; credentials moved verbatim.
  • cargo semver-checks on sourceorigin-common and sourceorigin-auth against origin/main (all features): no semver update required for either. AuthScheme is a new public item of sourceorigin-common.

Note

Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)

…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.
@PiquelChips PiquelChips added apps/auth-service Origin Auth at auth.sourceorigin.dev, its settings and developer console, and the operator CLI sdk Rust and TypeScript SDKs refactor No behviour changes labels Nov 22, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps/auth-service Origin Auth at auth.sourceorigin.dev, its settings and developer console, and the operator CLI refactor No behviour changes sdk Rust and TypeScript SDKs

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant