Add oauth package with RFC-compliant OAuth/OIDC utilities - #8
Closed
JAORMX wants to merge 1 commit into
Closed
Conversation
Add the oauth package which provides shared types, constants, and validation utilities for OAuth 2.0 and OpenID Connect. This package serves as a foundation for both OAuth clients and servers. Components: - constants.go: Well-known paths (RFC 8414, 9728), grant types, PKCE - errors.go: Validation errors for discovery documents - discovery.go: Types for OAuth AS Metadata and OIDC Discovery (RFC 8414) - redirect.go: Redirect URI validation per RFC 6749/8252 with policies The package uses github.com/ory/fosite for redirect URI validation, which is a well-established OAuth library. All code is extracted from toolhive/pkg/oauth with no modifications needed - the package had no toolhive-internal dependencies. Test coverage: 93.9% Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jhrozek
reviewed
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
oauthpackage providing shared types, constants, and validation utilities for OAuth 2.0 and OpenID Connecttoolhive/pkg/oauthas part of THV-0032 (Tier 1 graduation)Components
constants.goerrors.godiscovery.goredirect.goKey Features
RedirectURIPolicyStrict- HTTPS and HTTP loopback only (RFC 8252 Section 8.4)RedirectURIPolicyAllowPrivateSchemes- Also allows custom schemes likecursor://,vscode://(RFC 8252 Section 7.1)Dependencies
github.com/ory/fosite- Well-established OAuth library used for redirect URI security checksTest Plan
task test)task lint)task license-check)🤖 Generated with Claude Code