mgmtapi

package
v0.234.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package mgmtapi mounts the spec-driven Management API surface onto chi: one generic, bearer-protected handler per Auth0 Management API operation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(opts MountOpts) error

Mount walks the spec and registers one bearer-protected generic handler per Management API operation. Canned responses are registered out-of-band via the /admin0/expectations control plane, not per-operation siblings.

Types

type GenericHandler

type GenericHandler struct {
	Op        spec.Operation
	Validator *spec.Validator
	Store     *matches.Store
	Log       zerolog.Logger
	Strict    bool
	// Now supplies the time for {{now}} in templated responses. Nil means
	// time.Now.
	Now func() time.Time
}

GenericHandler is the main spec-driven handler for a Management API operation.

func (*GenericHandler) ServeHTTP

func (h *GenericHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MountOpts

type MountOpts struct {
	Router    chi.Router
	Spec      *spec.Spec
	Validator *spec.Validator
	Store     *matches.Store
	Keys      *jwks.KeySet
	Log       zerolog.Logger
	Strict    bool // SPEC_VALIDATION_STRICT.
	// RequireAudience, when non-empty, makes the bearer middleware reject
	// tokens whose `aud` claim doesn't contain this value. Empty = no
	// audience enforcement (the documented default).
	RequireAudience string
	// EventsHandler replaces the generic stub-driven handler for the
	// subscribe_events operation (GET /events). When non-nil, Mount
	// registers it for that one route behind the bearer check, with
	// registered error stubs consulted first (see eventsHandler). When nil,
	// the generic handler is used (the old behaviour — useful in tests
	// that don't care about the SSE surface).
	EventsHandler http.Handler
	// Now supplies the time for {{now}} in templated responses. Nil means
	// time.Now.
	Now func() time.Time
}

MountOpts is the parameter object for Mount.

Jump to

Keyboard shortcuts

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