admin0

package
v0.225.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package admin0 exposes the mock's control-plane endpoints under /admin0/*.

These endpoints are NEVER authenticated — they're meant for test setup and teardown from outside the bearer-protected Mgmt API surface.

Index

Constants

This section is empty.

Variables

View Source
var Fragment []byte

Fragment is the per-package OpenAPI 3.1 partial document describing every /admin0/* route registered in this package's Mount function. The genopenapi bundler merges it with the base Mgmt API spec to produce api/auth0-mock.openapi.json.

Functions

func Mount

func Mount(r chi.Router, d Deps)

Mount registers every /admin0/* route on r.

Types

type DeleteAllPermissionsHandler

type DeleteAllPermissionsHandler struct {
	Store *permissions.Store
}

DeleteAllPermissionsHandler removes every audience's permissions.

func (*DeleteAllPermissionsHandler) ServeHTTP

type DeleteClaimsHandler

type DeleteClaimsHandler struct {
	Store *claims.Store
}

DeleteClaimsHandler clears every custom claim.

func (*DeleteClaimsHandler) ServeHTTP

func (h *DeleteClaimsHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)

type DeleteExpectationsHandler

type DeleteExpectationsHandler struct {
	Store *matches.Store
}

DeleteExpectationsHandler clears expectations. An empty body clears all; a {method, path} body clears every expectation registered for that operation (the catch-all and every request-matched one).

Two intentional behaviours worth noting:

  • An empty/whitespace-only body means "clear all". The read error from io.ReadAll is deliberately ignored: a failed or empty read falls through to ResetAll, which is a benign outcome for a teardown DELETE.
  • Clearing an operation that was never registered is an idempotent no-op (returns 204). ResetEndpoint is documented as a no-op for unregistered keys, and DELETE intentionally does NOT validate {method, path} against the spec (unlike POST) because teardown should be forgiving.

func (*DeleteExpectationsHandler) ServeHTTP

type DeletePermissionsHandler

type DeletePermissionsHandler struct {
	Store *permissions.Store
}

DeletePermissionsHandler clears the permissions for one audience.

func (*DeletePermissionsHandler) ServeHTTP

type Deps

type Deps struct {
	Matches     *matches.Store
	Claims      *claims.Store
	Permissions *permissions.Store
	MFA         *mfa.Store
	Validator   *spec.Validator
}

Deps groups the in-memory stores admin0 controls.

type GetAllPermissionsHandler

type GetAllPermissionsHandler struct {
	Store *permissions.Store
}

GetAllPermissionsHandler returns the full per-audience permission map.

func (*GetAllPermissionsHandler) ServeHTTP

type GetClaimsHandler

type GetClaimsHandler struct {
	Store *claims.Store
}

GetClaimsHandler returns the per-process custom-claim map.

func (*GetClaimsHandler) ServeHTTP

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

type GetMFARequiredHandler

type GetMFARequiredHandler struct {
	Store *mfa.Store
}

GetMFARequiredHandler reports whether the password and password-realm grants currently demand MFA step-up.

func (*GetMFARequiredHandler) ServeHTTP

type GetPermissionsHandler

type GetPermissionsHandler struct {
	Store *permissions.Store
}

GetPermissionsHandler returns the permissions registered for one audience.

func (*GetPermissionsHandler) ServeHTTP

type ListExpectationsHandler

type ListExpectationsHandler struct {
	Store *matches.Store
}

ListExpectationsHandler returns every registered expectation.

func (*ListExpectationsHandler) ServeHTTP

type PostExpectationHandler

type PostExpectationHandler struct {
	Store     *matches.Store
	Validator *spec.Validator
}

PostExpectationHandler registers (upserts) an expectation for the Management API operation identified by {method, path}.

func (*PostExpectationHandler) ServeHTTP

type PutClaimsHandler

type PutClaimsHandler struct {
	Store *claims.Store
}

PutClaimsHandler replaces the per-process custom-claim map with the JSON object in the request body.

func (*PutClaimsHandler) ServeHTTP

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

type PutMFARequiredHandler

type PutMFARequiredHandler struct {
	Store *mfa.Store
}

PutMFARequiredHandler toggles MFA enforcement at runtime. Body: {"required":true|false}.

func (*PutMFARequiredHandler) ServeHTTP

type PutPermissionsHandler

type PutPermissionsHandler struct {
	Store *permissions.Store
}

PutPermissionsHandler sets the permissions for one audience to the JSON array in the request body.

func (*PutPermissionsHandler) ServeHTTP

type ResetHandler

type ResetHandler struct {
	Deps Deps
}

ResetHandler wipes every store admin0 governs: registered matches, custom claims, and per-audience permissions.

func (*ResetHandler) ServeHTTP

func (h *ResetHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)

Jump to

Keyboard shortcuts

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