Documentation
¶
Overview ¶
Package validating implements a validating webhook middleware for ToolHive. It calls external HTTP services to approve or deny MCP requests.
Index ¶
Constants ¶
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.