Skip to content

Move tokenexchange under pkg/oauthproto#5251

Merged
jhrozek merged 1 commit into
mainfrom
oauth-refactor-prep-5
May 11, 2026
Merged

Move tokenexchange under pkg/oauthproto#5251
jhrozek merged 1 commit into
mainfrom
oauth-refactor-prep-5

Conversation

@jhrozek
Copy link
Copy Markdown
Contributor

@jhrozek jhrozek commented May 11, 2026

Summary

  • pkg/auth/tokenexchange is relocated to pkg/oauthproto/tokenexchange so
    all RFC-defined OAuth 2.0 grant machinery lives in one place alongside the
    existing grant helpers (grants.go, oauthtest). Having the RFC 8693
    token-exchange grant under pkg/auth while other grant primitives live under
    pkg/oauthproto was inconsistent and would have grown more confusing as
    additional grant types land.

Type of change

  • Refactoring (no functional change)

Test plan

  • task test passes
  • task lint-fix passes
  • No stale pkg/auth/tokenexchange references remain (verified by grep across all .go, .md, .yaml, .json files)

Does this introduce a user-facing change?

No.

Special notes for reviewers

The regenerated docs/server/ swagger files are included. The OpenAPI schema
component key changed from github_com_stacklok_toolhive_pkg_auth_tokenexchange.Config
to github_com_stacklok_toolhive_pkg_oauthproto_tokenexchange.Config — this is
a swaggo artifact derived from the Go import path. The wire format of
tokenexchange.Config is unchanged.

Generated with Claude Code

Relocate pkg/auth/tokenexchange to pkg/oauthproto/tokenexchange so the
RFC 8693 Token Exchange grant sits next to the shared grant-helper
primitives (pkg/oauthproto/grants.go, pkg/oauthproto/oauthtest) and the
upcoming RFC 7523 JWT Bearer grant. With the refactor complete,
pkg/oauthproto is the single home for OAuth 2.0 grant machinery in this
repo; having one grant under pkg/auth and another under pkg/oauthproto
would have been confusing.

Pure rename. All source files move intact; every import path updated
from github.com/stacklok/toolhive/pkg/auth/tokenexchange to
github.com/stacklok/toolhive/pkg/oauthproto/tokenexchange. Also updated
stale doc and agent references to the old path in docs/middleware.md,
docs/operator/crd-api.md, and .claude/agents/oauth-expert.md. Regenerated
docs/server/ swagger so the schema component key reflects the new import
path. The wire format of tokenexchange.Config is unchanged; only the
OpenAPI $ref key (a swaggo artifact derived from the Go import path)
differs.

task test and task lint-fix are clean.
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label May 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.99%. Comparing base (d62dd0e) to head (62c8dc1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5251      +/-   ##
==========================================
- Coverage   68.02%   67.99%   -0.04%     
==========================================
  Files         615      615              
  Lines       62960    62960              
==========================================
- Hits        42829    42807      -22     
- Misses      16929    16952      +23     
+ Partials     3202     3201       -1     

☔ 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.

@jhrozek jhrozek merged commit ab90ddc into main May 11, 2026
76 of 78 checks passed
@jhrozek jhrozek deleted the oauth-refactor-prep-5 branch May 11, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants