Skip to content

[PM-23189] Add ClientManagedTokens trait #337

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
merged 17 commits into from
Jul 3, 2025
Merged

Conversation

Hinton
Copy link
Member

@Hinton Hinton commented Jun 30, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-23189

📔 Objective

Adds support for client managed access tokens alongside SDK managed access tokens.

It does so by splitting Tokens into SdkManaged and ClientManaged. ClientManaged relies on the consumer implementing a trait with get_access_token function.

In WASM this is exposed as a TokenProvider interface which can be implemented in TS clients using:

class JsTokenProvider implements TokenProvider {
  constructor(private apiService: ApiService) {}

  async get_access_token(): Promise<string> {
    return await this.apiService.getActiveBearerToken();
  }
}

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor

github-actions bot commented Jun 30, 2025

Logo
Checkmarx One – Scan Summary & Details609d53f5-c42c-402f-bb5a-c0b1d0f3f756

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Jun 30, 2025

Codecov Report

Attention: Patch coverage is 33.33333% with 40 lines in your changes missing coverage. Please review.

Project coverage is 71.62%. Comparing base (4e60721) to head (5c67cd4).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
crates/bitwarden-core/src/auth/renew.rs 28.57% 15 Missing ⚠️
...arden-wasm-internal/src/platform/token_provider.rs 0.00% 12 Missing ⚠️
crates/bitwarden-core/src/client/client.rs 45.45% 6 Missing ⚠️
...es/bitwarden-core/src/platform/get_user_api_key.rs 0.00% 4 Missing ⚠️
crates/bitwarden-wasm-internal/src/client.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #337      +/-   ##
==========================================
- Coverage   71.70%   71.62%   -0.08%     
==========================================
  Files         238      239       +1     
  Lines       19317    19346      +29     
==========================================
+ Hits        13851    13857       +6     
- Misses       5466     5489      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Hinton added a commit that referenced this pull request Jul 1, 2025
Changes `get_client_managed` to return a `Result<_, RepositoryNotFound>`
based on discussions in
#337 (comment)
@Hinton Hinton changed the title Add ClientManagedTokens trait [PM-23189] Add ClientManagedTokens trait Jul 1, 2025
@Hinton Hinton marked this pull request as ready for review July 1, 2025 08:43
@Hinton Hinton requested a review from a team as a code owner July 1, 2025 08:43
@Hinton Hinton requested review from addisonbeck and dani-garcia July 1, 2025 08:43
Copy link

sonarqubecloud bot commented Jul 1, 2025

Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

LGTM

@Hinton Hinton merged commit d5c0dc5 into main Jul 3, 2025
50 checks passed
@Hinton Hinton deleted the arch/client-managed-tokens branch July 3, 2025 07:56
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