Help us shape the future of Go! Take the 2026 Go Developer Survey

validating

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package validating implements a validating webhook middleware for ToolHive. It calls external HTTP services to approve or deny MCP requests.

Index

Constants

View Source
const MiddlewareType = "validating-webhook"

MiddlewareType is the type constant for the validating webhook middleware.

Variables

This section is empty.

Functions

func CreateMiddleware

func CreateMiddleware(config *types.MiddlewareConfig, runner types.MiddlewareRunner) error

CreateMiddleware is the factory function for validating webhook middleware.

Types

type FactoryMiddlewareParams

type FactoryMiddlewareParams struct {
	MiddlewareParams
	// ServerName is the name of the ToolHive instance.
	ServerName string `json:"server_name"`
	// Transport is the transport type (e.g., sse, stdio).
	Transport string `json:"transport"`
}

FactoryMiddlewareParams extends MiddlewareParams with context for the factory.

type Middleware

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

Middleware wraps validating webhook functionality for the factory pattern.

func (*Middleware) Close

func (*Middleware) Close() error

Close cleans up any resources used by the middleware.

func (*Middleware) Handler

func (m *Middleware) Handler() types.MiddlewareFunction

Handler returns the middleware function used by the proxy.

type MiddlewareParams

type MiddlewareParams struct {
	// Webhooks is the list of validating webhook configurations to call.
	// Webhooks are called in configuration order; if any webhook denies the request,
	// the request is rejected. All webhooks must allow the request for it to proceed.
	Webhooks []webhook.Config `json:"webhooks"`
}

MiddlewareParams holds the configuration parameters for the validating webhook middleware.

func (*MiddlewareParams) Validate

func (p *MiddlewareParams) Validate() error

Validate checks that the MiddlewareParams are valid.

Jump to

Keyboard shortcuts

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