Skip to content

Add OAuth client factory with RFC 8252 loopback support to authserver - #3263

Merged
jhrozek merged 3 commits into
mainfrom
auth-proxy-pr-3-client
Jan 13, 2026
Merged

jhrozek merged 3 commits into
mainfrom
auth-proxy-pr-3-client

Conversation

@jhrozek

@jhrozek jhrozek commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Add client factory and LoopbackClient for native OAuth clients like VS Code and Claude Code. Currently the code is unused (but tested!), when integrated, the authorize handler will use LoopbackClient.

LoopbackClient wraps fosite.DefaultClient to provide RFC 8252 Section 7.3 dynamic port matching for "localhost" hostname. Fosite's built-in isMatchingAsLoopback uses net.ParseIP().IsLoopback() which only supports IP addresses (127.0.0.1, ::1), not the "localhost" hostname.

@github-actions github-actions Bot added the size/L Large PR: 600-999 lines changed label Jan 12, 2026
@codecov

codecov Bot commented Jan 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.63%. Comparing base (bc0d112) to head (3dc2ba7).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/authserver/server/registration/client.go 88.88% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3263      +/-   ##
==========================================
- Coverage   63.64%   63.63%   -0.01%     
==========================================
  Files         361      362       +1     
  Lines       35449    35521      +72     
==========================================
+ Hits        22560    22605      +45     
- Misses      11082    11099      +17     
- Partials     1807     1817      +10     

☔ 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 force-pushed the auth-proxy-pr-3-client branch from b577265 to 362dc5e Compare January 13, 2026 15:06
jhrozek and others added 2 commits January 13, 2026 15:06
Add client factory and LoopbackClient for native OAuth clients like
VS Code and Claude Code. Currently the code is unused (but tested!),
when integrated, the authorize handler will use LoopbackClient.

LoopbackClient wraps fosite.DefaultClient to provide RFC 8252 Section
7.3 dynamic port matching for "localhost" hostname. Fosite's built-in
isMatchingAsLoopback uses net.ParseIP().IsLoopback() which only supports
IP addresses (127.0.0.1, ::1), not the "localhost" hostname.
Add explicit documentation that hostnamesMatch receives pre-parsed
hostname strings from url.Hostname(), not raw URIs. This clarifies
the function's contract and its relationship with matchesAsLoopback.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@jhrozek
jhrozek force-pushed the auth-proxy-pr-3-client branch from 362dc5e to 72b1892 Compare January 13, 2026 15:06
@github-actions github-actions Bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants