Skip to content

feat(clients): Add static token auth, consolidate token generator#330

Merged
lcian merged 13 commits intomainfrom
feat/static-token-auth
Feb 24, 2026
Merged

feat(clients): Add static token auth, consolidate token generator#330
lcian merged 13 commits intomainfrom
feat/static-token-auth

Conversation

@lcian
Copy link
Copy Markdown
Member

@lcian lcian commented Feb 23, 2026

Summary

  • Add static token auth option to both Rust and Python clients
  • Both token and token generator are now unified into a single token parameter on Client/ClientBuilder
  • Rust: TokenProvider enum with Static and Generator variants, ClientBuilder::token(impl Into<TokenProvider>)
  • Python: Token = TokenGenerator | str type alias, Client(token=...)

Add a `token` option that accepts a pre-signed JWT string and sets it
as the Authorization header on every request. This is intended for
external services that receive a token from another source and don't
have access to the EdDSA signing key.

The static token takes precedence over a TokenGenerator if both are
configured. Documentation across both clients clarifies when to use
each option.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 23, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (clients) Add static token auth, consolidate token generator by lcian in #330
  • (python-client) Improve retries for compressed bodies by lcian in #329

Bug Fixes 🐛

  • (rust-client) Check HTTP status on DELETE responses by lcian in #333

🤖 This preview updates automatically when you update the PR.

A token is scoped to a specific usecase and scope, so it belongs on
the session rather than the client.

Rust: Session::with_token() builder method
Python: token parameter on Client.session()
When both a TokenGenerator and a static token are configured, the
TokenGenerator now takes precedence since it generates fresh,
properly-scoped tokens for each request.
Prevent the JWT from leaking in logs by implementing Debug manually
instead of deriving it, matching the pattern used by SecretKey.
@lcian lcian marked this pull request as ready for review February 24, 2026 10:14
@lcian lcian requested a review from a team as a code owner February 24, 2026 10:14
Comment thread clients/python/src/objectstore_client/client.py Outdated
Comment thread clients/python/src/objectstore_client/client.py Outdated
Comment thread clients/python/src/objectstore_client/client.py Outdated
…ken param

Introduce a TokenProvider enum (Rust) and Token type alias (Python) that
accepts either a TokenGenerator or a static JWT string. Authentication is
now configured once on the Client/ClientBuilder instead of being split
between Client and Session.
@lcian lcian marked this pull request as draft February 24, 2026 10:41
@lcian lcian changed the title feat(clients): Add static token auth option to Rust and Python clients feat(clients): Unified token auth for Rust and Python clients Feb 24, 2026
# Conflicts:
#	clients/python/src/objectstore_client/client.py
@lcian lcian changed the title feat(clients): Unified token auth for Rust and Python clients feat(clients): Add static token auth, consolidate token generator Feb 24, 2026
@lcian
Copy link
Copy Markdown
Member Author

lcian commented Feb 24, 2026

bugbot run

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread clients/python/src/objectstore_client/auth.py
… usage

Rename the Python type alias from Token to TokenProvider to match Rust.
Add documentation on how to obtain a static token from a TokenGenerator.
Expose a public sign() method on TokenGenerator so that callers can
produce a static JWT to hand off to external consumers. Update README
with an example.
Expose a public sign() method on TokenGenerator that takes a &Scope,
allowing callers to produce static JWT tokens for external consumers.
Update README and Client docstring with usage examples.
Remove unused std::intrinsics::unreachable import and dead inner()
method. Fix cross-crate doc link in InvalidScopeError::Unreachable.
@lcian lcian marked this pull request as ready for review February 24, 2026 12:27
@lcian lcian merged commit 106bb69 into main Feb 24, 2026
20 checks passed
@lcian lcian deleted the feat/static-token-auth branch February 24, 2026 12:35
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.

2 participants