oauth

package
v0.12.0-rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package oauth provides a small test harness for OAuth flows used by Claude Remote MCP connectors (DCR + PKCE + refresh).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeOptions

type AuthorizeOptions struct {
	// McpEndpoint is the protected MCP resource URL (the `/mcp` endpoint).
	McpEndpoint string
	// Origin is passed as the Origin header on the first MCP call.
	// Defaults to https://claude.ai.
	Origin string
	// RedirectURI must match the authorization server policy allowlist.
	RedirectURI string
}

type ClaudePublicClient

type ClaudePublicClient struct {
	// contains filtered or unexported fields
}

ClaudePublicClient is an OAuth test client that emulates Claude connector behavior.

func NewClaudePublicClient

func NewClaudePublicClient(httpClient *http.Client) *ClaudePublicClient

NewClaudePublicClient creates a client. If httpClient is nil, a default client is created that does not automatically follow redirects (required to capture authorization codes from Location headers).

func (*ClaudePublicClient) Authorize

Authorize performs: - 401 challenge parsing (WWW-Authenticate) - protected resource metadata fetch - AS metadata fetch - DCR - Authorization Code + PKCE - Token exchange + refresh

type DCRResult

type DCRResult struct {
	ClientID string
}

type Discovery

type Discovery struct {
	ResourceMetadataURL         string
	ProtectedResourceMetadata   *oauthruntime.ProtectedResourceMetadata
	AuthorizationServerMetadata *oauthruntime.AuthorizationServerMetadata
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int64  `json:"expires_in,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL