httphandler

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCodeData

type AuthCodeData struct {
	ClientID            string `json:"client_id,omitempty"`
	CodeChallenge       string `json:"code_challenge"`
	CodeChallengeMethod string `json:"code_challenge_method"`
	Resource            string `json:"resource,omitempty"`
	UpstreamTokenKey    string `json:"upstream_token_key"` // アップストリーム・トークンのRedisキー
	MCPServerName       string `json:"mcp_server_name"`
}

AuthCodeData 認証コードとトークンの交換に関するデータを保持。

type AuthHandler

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

AuthHandler CLIおよびMCPクライアントの両方に対して、OAuth 2.1認証サーバーを実装。

func NewAuthHandler

func NewAuthHandler(storeClient store.Client, servers config.Servers, opts ...AuthHandlerOption) *AuthHandler

func (*AuthHandler) CallbackEndpoint

func (h *AuthHandler) CallbackEndpoint(w http.ResponseWriter, r *http.Request, srv *config.Server)

func (*AuthHandler) LoginEndpoint

func (h *AuthHandler) LoginEndpoint(w http.ResponseWriter, r *http.Request, srv *config.Server)

func (*AuthHandler) MetadataEndpoint

func (h *AuthHandler) MetadataEndpoint(w http.ResponseWriter, r *http.Request, srv *config.Server)

MetadataEndpoint serves /.well-known/oauth-authorization-server

func (*AuthHandler) OauthProtectedResource

func (h *AuthHandler) OauthProtectedResource(w http.ResponseWriter, r *http.Request, srv *config.Server)

func (*AuthHandler) RegisterClientEndpoint

func (h *AuthHandler) RegisterClientEndpoint(w http.ResponseWriter, r *http.Request, srv *config.Server)

RegisterClientEndpoint POST /auth/clients リクエストを処理します(動的クライアント登録、RFC 7591)。

func (*AuthHandler) RegisterClientEndpointByClaudeCode added in v1.2.0

func (h *AuthHandler) RegisterClientEndpointByClaudeCode(w http.ResponseWriter, r *http.Request)

RegisterClientEndpoint POST /auth/clients リクエストを処理します(動的クライアント登録、RFC 7591)。

func (*AuthHandler) RegisterRoutes

func (h *AuthHandler) RegisterRoutes(mux *http.ServeMux, pathServerName string, middleware func(h http.HandlerFunc) http.HandlerFunc)

func (*AuthHandler) TokenEndpoint

func (h *AuthHandler) TokenEndpoint(w http.ResponseWriter, r *http.Request, srv *config.Server)

type AuthHandlerOption added in v1.2.0

type AuthHandlerOption func(h *AuthHandler)

func WithEncryptKey added in v1.2.0

func WithEncryptKey(key []byte) AuthHandlerOption

func WithEncryptKeyByBase64 added in v1.2.0

func WithEncryptKeyByBase64(key string) AuthHandlerOption

type AuthSession

type AuthSession struct {
	ClientID            string `json:"client_id,omitempty"`
	RedirectURI         string `json:"redirect_uri,omitempty"`
	State               string `json:"state,omitempty"`
	CodeChallenge       string `json:"code_challenge,omitempty"`
	CodeChallengeMethod string `json:"code_challenge_method,omitempty"`
	Resource            string `json:"resource,omitempty"` // RFC 8707
	// アップストリームのOAuth2設定のスナップショット(コールバック時に必要)
	OAuth2ClientID     string   `json:"oauth2_client_id,omitempty"`
	OAuth2ClientSecret string   `json:"oauth2_client_secret,omitempty"`
	OAuth2TokenURL     string   `json:"oauth2_token_url,omitempty"`
	OAuth2Scopes       []string `json:"oauth2_scopes,omitempty"`
	// 上流認可サーバーへのリクエストで使用した PKCE code_verifier
	UpstreamCodeVerifier string `json:"upstream_code_verifier,omitempty"`
	MCPServerName        string `json:"mcp_server_name"`
}

AuthSession 進行中の認証セッションのために、Redisに保存されたデータを保持。

type ClientRegistration

type ClientRegistration struct {
	ClientID                string   `json:"client_id"`
	ClientIDIssuedAt        int64    `json:"client_id_issued_at"`
	RedirectURIs            []string `json:"redirect_uris"`
	GrantTypes              []string `json:"grant_types"`
	ResponseTypes           []string `json:"response_types"`
	ClientName              string   `json:"client_name,omitempty"`
	TokenEndpointAuthMethod string   `json:"token_endpoint_auth_method,omitempty"`
}

ClientRegistration 動的に登録された OAuth 2.0 クライアント(RFC 7591)を保持。

type MCPHandler added in v1.2.0

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

func NewMCPHandler added in v1.2.0

func NewMCPHandler(cfg config.Servers) *MCPHandler

func (*MCPHandler) MCPList added in v1.2.0

func (h *MCPHandler) MCPList(w http.ResponseWriter, r *http.Request)

type RefreshTokenSession added in v1.2.1

type RefreshTokenSession struct {
	OAuth2ClientID     string   `json:"oauth2_client_id"`
	OAuth2ClientSecret string   `json:"oauth2_client_secret"`
	OAuth2TokenURL     string   `json:"oauth2_token_url"`
	OAuth2Scopes       []string `json:"oauth2_scopes"`
	MCPServerName      string   `json:"mcp_server_name"`
	Resource           string   `json:"resource,omitempty"`
	ClientID           string   `json:"client_id,omitempty"`
}

RefreshTokenSession リフレッシュトークン使用時に上流 OAuth2 設定を復元するためのデータ。

type StoreClientRegistration added in v1.2.0

type StoreClientRegistration struct {
	ClientRegistration
	MCPServerName string `json:"mcp_server_name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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