controlapi

package
v0.1.0 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: 0

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