controlapi

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RoleAdmin  = config.AuthRoleAdmin
	RoleViewer = config.AuthRoleViewer
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(runtime *Runtime) http.Handler

Types

type AuthInfo

type AuthInfo struct {
	Name string `json:"name"`
	Role string `json:"role"`
}

AuthInfo describes the authenticated Admin API caller.

func AuthInfoFromContext

func AuthInfoFromContext(ctx context.Context) (AuthInfo, bool)

AuthInfoFromContext returns caller auth info from a request context.

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

Authenticator validates Admin API bearer tokens.

func NewAuthenticator

func NewAuthenticator(cfg config.AuthConfig) *Authenticator

NewAuthenticator builds an authenticator from config.

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(r *http.Request) (AuthInfo, bool)

Authenticate validates the Authorization header and returns caller info.

func (*Authenticator) Enabled

func (a *Authenticator) Enabled() bool

Enabled returns whether authentication is enforced.

type Runtime

type Runtime struct {
	ConfigPath      string
	Manager         *engine.Manager
	Logger          *slog.Logger
	Auth            *Authenticator
	Metrics         *metrics.Collector
	PrecheckOptions *precheck.Options
	CertStore       *certstore.Store
	CertReviewer    *certreview.Reviewer
}

func (*Runtime) Precheck

func (runtime *Runtime) Precheck() (config.File, precheck.Result, error)

func (*Runtime) Reload

func (runtime *Runtime) Reload() (config.File, engine.ApplyResult, error)

Jump to

Keyboard shortcuts

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