apiwire

package
v1.126.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package apiwire composes the operation browser's read surface from the registries a deployment holds: which connections a caller reaches, which toolkit answers for one, and how a caller's identity reaches the route policy.

It is a package of its own rather than another file in the composition root because that root is at its size budget, and it takes the registries and the portal's already-built auth chain as inputs rather than the platform facade, which is the boundary every other adapter under internal/httpserver keeps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(mux *http.ServeMux, wrap func(http.Handler) http.Handler, deps Deps)

Mount registers the browser's routes on mux behind the portal's own authentication and persona gate.

The routes are mounted whether or not an api-gateway toolkit is loaded. An absent route under /api/v1 falls through to the MCP root handler, which answers 401 to a browser fetch carrying only a session cookie, and the portal client turns a 401 into a redirect to the login screen. A deployment with no api connections must answer "you reach none", which is the empty state the page renders, rather than throwing its reader out of the portal.

Types

type Deps

type Deps struct {
	// Toolkits is the live toolkit registry. Nil leaves the routes unmounted.
	Toolkits *registry.Registry
	// Personas resolves a persona's connection rules. Nil denies every named
	// connection, matching the fail-closed action path.
	Personas *persona.Registry
	// Resolver maps a caller's roles to their persona. Nil leaves every caller
	// without one, which reaches nothing.
	Resolver portal.PersonaResolver
	// AdminRoles are the roles the admin persona is granted, which is what
	// makes a caller's reach over this surface unrestricted.
	AdminRoles []string
}

Deps are what the browser needs to answer for one caller. The registries are held rather than snapshotted, so a connection added or a persona edited through the admin API takes effect on the next request.

Jump to

Keyboard shortcuts

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