Documentation
¶
Index ¶
- func Build(entries []config.PluginEntry, opts ...pipeline.Option) (*pipeline.Pipeline, error)
- func BuildWithDeps(entries []config.PluginEntry, deps Deps, opts ...pipeline.Option) (*pipeline.Pipeline, error)
- func BuildWithSPIFFE(entries []config.PluginEntry, p *spiffe.Provider, opts ...pipeline.Option) (*pipeline.Pipeline, error)
- func CollectStats(p *pipeline.Pipeline) []*auth.Stats
- func PricingConsumerPlugins() []string
- func RegisterPlugin(name string, factory PluginFactory)
- func RegisteredPlugins() []string
- func SPIFFEConsumerPlugins() []string
- func UnregisterPlugin(name string) bool
- func WarmCatalog()
- type CatalogEntry
- type Deps
- type PluginFactory
- type StatsSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build constructs a pipeline from an ordered list of plugin entries. For every plugin that implements pipeline.Configurable, Build calls Configure with the entry's Config bytes (nil when omitted). Passing config to a plugin that doesn't implement Configurable is rejected so stale or misplaced config blocks fail at startup instead of being silently ignored.
Unknown plugin names fail fast with an error that lists every currently-registered plugin — typo-catching diagnostic.
Injects nothing. A thin wrapper over BuildWithDeps, which is the single implementation; see there for the Configure and injection contract.
func BuildWithDeps ¶
func BuildWithDeps(entries []config.PluginEntry, deps Deps, opts ...pipeline.Option) (*pipeline.Pipeline, error)
BuildWithDeps constructs a pipeline from an ordered list of plugin entries, injecting each supplied dependency into the plugins that consume it.
For every plugin implementing pipeline.Configurable, Configure is called with the entry's Config bytes (nil when omitted). Passing config to a plugin that does not implement Configurable is rejected, so stale or misplaced config blocks fail at startup instead of being silently ignored. Unknown plugin names fail fast with an error listing every registered plugin.
Dependencies are injected BEFORE Configure runs, so configuration code can use them. That ordering is the contract, not an implementation detail: a plugin's Configure may build rate- or identity-dependent state, and an injection landing afterwards would be silently too late.
A nil dependency is NOT injected, rather than injected as nil. Handing a plugin a typed-nil interface would make its own `!= nil` guard true while every call through it panicked.
This is the single builder. Build and BuildWithSPIFFE delegate here; before this they were two copies of the same forty lines, differing only in one injection.
func BuildWithSPIFFE ¶
func BuildWithSPIFFE(entries []config.PluginEntry, p *spiffe.Provider, opts ...pipeline.Option) (*pipeline.Pipeline, error)
BuildWithSPIFFE is Build plus dependency injection of the framework SPIFFE Provider. Every plugin satisfying spiffe.ProviderConsumer receives p via SetSPIFFEProvider before its Configure is invoked, so configuration code can use the provider's sources directly.
Pass nil for p in builds that don't need SPIFFE; in that case the behavior is equivalent to Build for non-consuming plugins, and consumer plugins are NOT called (their SetSPIFFEProvider is skipped).
Plugins that don't implement ProviderConsumer are unaffected.
A thin wrapper over BuildWithDeps. It survives as a named entry point because four binaries call it; new dependencies go through Deps rather than growing a third builder.
func CollectStats ¶
CollectStats walks a pipeline and returns every *auth.Stats exposed by a StatsSource-implementing plugin. Order matches plugin declaration order in the pipeline, which keeps the aggregated output deterministic.
Returns nil (not an empty slice) when no plugins implement StatsSource, so callers can pass the result straight to auth.MergeStats without guarding against zero-length.
func PricingConsumerPlugins ¶
func PricingConsumerPlugins() []string
PricingConsumerPlugins lists the registered plugins whose instances implement pricing.ResolverConsumer — the plugins BuildWithDeps would inject the Registry into.
Callers that gate Registry construction on actual need use this to assert their need-detection covers every consumer; a new consumer slipping past the predicate would otherwise silently receive no resolver and report its traffic as unpriced, which looks identical to having no rates configured.
Probes by constructing each plugin and type-asserting, which is safe because PluginFactory is contractually a cheap, side-effect-free constructor. Mirrors SPIFFEConsumerPlugins; if a factory ever gains construction-time side effects, both switch to a static capability tag instead of a live probe.
func RegisterPlugin ¶
func RegisterPlugin(name string, factory PluginFactory)
RegisterPlugin adds a plugin factory under name. Intended to be called from package init() functions of plugin implementations:
func init() {
plugins.RegisterPlugin("rate-limiter", func() pipeline.Plugin {
return &RateLimiter{}
})
}
This is the stdlib pattern (database/sql.Register, image codec registration, log/slog handler registration): plugins live in their own package and advertise themselves by side-effect import:
import _ "github.com/acme/rossoctl-rate-limiter/ratelimit"
Double-registration under the same name panics. Silent last-write- wins would let a version mismatch or deployment bug poison the registry in ways that only surface as mysterious runtime behaviour; failing loud at process start is strictly safer.
Empty name or nil factory also panics — both are programmer errors, not recoverable conditions.
func RegisteredPlugins ¶
func RegisteredPlugins() []string
RegisteredPlugins returns the names of every registered plugin in sorted order. Intended for diagnostic surfaces (/config, CLI --help, Build's "unknown plugin" error message) and for tests that assert a plugin is visible to the builder.
func SPIFFEConsumerPlugins ¶
func SPIFFEConsumerPlugins() []string
SPIFFEConsumerPlugins returns the sorted names of registered plugins whose instances implement spiffe.ProviderConsumer — i.e. the plugins BuildWithSPIFFE would inject the Provider into. Callers that gate Provider construction on actual need (see cmd/authbridge-proxy's spiffeProviderNeeded) use this to assert their need-detection covers every consumer; a new consumer that slips past the predicate would otherwise silently receive a nil Provider.
This probes by constructing each plugin and type-asserting. That is safe because PluginFactory is contractually a cheap, side-effect-free constructor (see PluginFactory: no construction args; deps + goroutines are created in Configure/Init, not the factory). If a factory ever gains construction-time side effects, switch this to a static capability tag instead of a live probe.
func UnregisterPlugin ¶
UnregisterPlugin removes a plugin factory from the registry. Intended for test isolation: a test registers a fake plugin, runs, and uses t.Cleanup to unregister so parallel tests aren't poisoned by the leftover entry.
Do not call from production code. The registry is intended to be written exactly once per plugin per process, at init() time; runtime deregistration has no valid use case in a running authbridge binary and would make the /config endpoint lie about pipeline composition.
Returns true when the name was registered (and is now removed), false when it wasn't. Callers ignoring the return value are common and correct — Cleanup doesn't care.
func WarmCatalog ¶
func WarmCatalog()
WarmCatalog triggers Catalog() at boot so any plugin whose factory violates the constructor contract (panics, allocates goroutines / connections / file handles) surfaces during startup rather than silently caching a faulty throwaway instance on the first /v1/plugins request. Cheap insurance — the result is already memoized, so calling this at boot moves "first call" out of the request hot path.
Intended for the binary's main() to invoke once after all plugin init() registrations have run (typically right before sessionapi.New).
Types ¶
type CatalogEntry ¶
type CatalogEntry struct {
Name string
Capabilities pipeline.PluginCapabilities
Fields []pipeline.FieldSchema
}
CatalogEntry pairs a registered plugin's name with the capabilities it advertises and the field-level schema of its config (if it implements pipeline.SchemaProvider). Surfaces in `abctl`'s catalog pane, in the /v1/plugins endpoint, and in `abctl edit`'s template renderer so operators can see what plugins exist, what each one needs, and what each field means without reading source.
Fields is nil for plugins without a config (or that don't implement SchemaProvider) — the wire format omits the field via `omitempty`, so existing consumers that don't know about field schemas keep working.
func Catalog ¶
func Catalog() []CatalogEntry
Catalog returns a sorted snapshot of every registered plugin's capabilities. The result is computed on first call and cached; subsequent calls return the cached slice (do not mutate it).
First-call mechanics: each registered factory is invoked once with no config; the resulting instance's Capabilities() is the static type-level metadata that the rest of the framework also reads.
CONSTRUCTOR CONTRACT: factories called from Catalog MUST NOT allocate goroutines, network connections, file handles, or other resources that need explicit teardown. Allocate the plugin struct and nothing more — heavy work belongs in Init() (after Configure()), where the framework owns the lifecycle. The throwaway instance Catalog constructs is never Shutdown'd; anything it leaks is process-wide.
The godoc on PluginCapabilities documents the parallel constraint that Capabilities() must be instance-state-independent (so the cached snapshot from one instance describes every instance the factory produces).
type Deps ¶
type Deps struct {
// SPIFFE is injected into plugins implementing spiffe.ProviderConsumer.
SPIFFE *spiffe.Provider
// Pricing is injected into plugins implementing pricing.ResolverConsumer.
// Long-lived: the reloader rebuilds pipelines but the resolver is swapped in
// place, so a plugin from any build sees current rates. See pricing.Registry.
Pricing *pricing.Registry
}
Deps are the process-wide dependencies a pipeline build can inject into plugins.
Plugin factories take no construction arguments (see PluginFactory), so anything shared across the process has to arrive this way. A struct rather than a growing parameter list: BuildWithSPIFFE existed because SPIFFE needed injecting, and adding pricing the same way would have meant a third near-identical builder.
Every field is optional. A zero Deps builds exactly what Build always did.
type PluginFactory ¶
PluginFactory returns a fresh plugin instance. Plugins take no construction arguments — they receive their configuration through pipeline.Configurable.Configure during Build, and any external dependencies (JWKS cache, HTTP client, etc.) are built from that local config inside Configure.
type StatsSource ¶
StatsSource is an optional interface a plugin implements when it maintains observability counters worth exposing on the /stats endpoint. Lives in the plugins package (rather than pipeline) because auth.Stats is the shared counter type and the pipeline package has no reason to depend on auth.
Plugins that don't report stats don't implement this interface; the host skips them during aggregation.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package contextguru is an outbound AuthBridge plugin that compacts an agent's LLM request context before it is forwarded upstream, using the embedded github.com/rossoctl/context-guru engine.
|
Package contextguru is an outbound AuthBridge plugin that compacts an agent's LLM request context before it is forwarded upstream, using the embedded github.com/rossoctl/context-guru engine. |
|
Package cpex bridges AuthBridge requests through the CPEX (Context Plugin Execution) framework so operators can drive policy with CPEX's APL (Attribute Policy Language) DSL — or any of the pre-built CPEX plugins (Cedar PDP, PII scanner, audit logger, JWT identity, OAuth delegation) — without writing Go code.
|
Package cpex bridges AuthBridge requests through the CPEX (Context Plugin Execution) framework so operators can drive policy with CPEX's APL (Attribute Policy Language) DSL — or any of the pre-built CPEX plugins (Cedar PDP, PII scanner, audit logger, JWT identity, OAuth delegation) — without writing Go code. |
|
Package ibac implements an Intent-Based Access Control plugin for authbridge.
|
Package ibac implements an Intent-Based Access Control plugin for authbridge. |
|
internal
|
|
|
parsercommon
Package parsercommon holds small helpers shared by the in-tree protocol parser plugins (a2a-parser, mcp-parser, inference-parser).
|
Package parsercommon holds small helpers shared by the in-tree protocol parser plugins (a2a-parser, mcp-parser, inference-parser). |
|
validation
Package validation provides JWT verification with JWKS-based key resolution.
|
Package validation provides JWT verification with JWKS-based key resolution. |
|
Package lineage provides the lineage-telemetry authbridge plugin.
|
Package lineage provides the lineage-telemetry authbridge plugin. |
|
Package litellm_budgettrack provides a pipeline plugin that tracks per-request cost and enforces a daily spending budget, rejecting requests with HTTP 429 when the budget is exceeded.
|
Package litellm_budgettrack provides a pipeline plugin that tracks per-request cost and enforces a daily spending budget, rejecting requests with HTTP 429 when the budget is exceeded. |
|
Package plugintesting exposes stub plugin adapters for listener tests that need to inject pre-built *auth.Auth instances (for example, with a mock verifier or a mock exchanger) without going through the real plugins' Configure path.
|
Package plugintesting exposes stub plugin adapters for listener tests that need to inject pre-built *auth.Auth instances (for example, with a mock verifier or a mock exchanger) without going through the real plugins' Configure path. |
|
Package sessionbudget enforces per-session lifetime budgets on tokens, inference calls, and wall-clock duration.
|
Package sessionbudget enforces per-session lifetime budgets on tokens, inference calls, and wall-clock duration. |
|
Package sparc implements a pre-tool reflection plugin for authbridge.
|
Package sparc implements a pre-tool reflection plugin for authbridge. |
|
Package staticinject implements the static-inject outbound AuthBridge plugin: it swaps a placeholder credential on the outbound Authorization header for a real static credential, so a model-influenced workload never holds the real secret.
|
Package staticinject implements the static-inject outbound AuthBridge plugin: it swaps a placeholder credential on the outbound Authorization header for a real static credential, so a model-influenced workload never holds the real secret. |
|
client
Package client provides an HTTP client for the Token Broker service.
|
Package client provides an HTTP client for the Token Broker service. |
|
cache
Package cache provides a SHA-256 keyed token cache with TTL-based eviction.
|
Package cache provides a SHA-256 keyed token cache with TTL-based eviction. |
|
exchange
Package exchange implements RFC 8693 OAuth 2.0 Token Exchange and client credentials grant.
|
Package exchange implements RFC 8693 OAuth 2.0 Token Exchange and client credentials grant. |
|
Package toolprune removes unused tool definitions from outbound inference requests.
|
Package toolprune removes unused tool definitions from outbound inference requests. |