api

package
v0.0.0-pre.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthenticate

func DefaultAuthenticate(d *Daemon, w http.ResponseWriter, r *http.Request) (bool, string, string, error)

DefaultAuthenticate validates an incoming http Request It will check over what protocol it came, what type of request it is and will validate the TLS certificate.

This does not perform authorization, only validates authentication. Returns whether trusted or not, the username (or certificate fingerprint) of the trusted client, and the type of client that has been authenticated (unix or tls).

func TokenAuthenticate

func TokenAuthenticate(d *Daemon, w http.ResponseWriter, r *http.Request) (bool, string, string, error)

TokenAuthenticate attempts normal authentication, and falls back to token-based authentication. If using token-based authentication, the request will be assumed to be coming from the migration worker.

Types

type APIEndpoint

type APIEndpoint struct {
	Path   string // Path pattern for this endpoint.
	Get    APIEndpointAction
	Head   APIEndpointAction
	Put    APIEndpointAction
	Post   APIEndpointAction
	Delete APIEndpointAction
	Patch  APIEndpointAction
}

APIEndpoint represents a URL in our API.

type APIEndpointAction

type APIEndpointAction struct {
	Handler        func(d *Daemon, r *http.Request) response.Response
	AccessHandler  func(d *Daemon, r *http.Request) response.Response
	Authenticator  Authenticator
	AllowUntrusted bool
}

APIEndpointAction represents an action on an API endpoint.

type Authenticator

type Authenticator func(d *Daemon, w http.ResponseWriter, r *http.Request) (bool, string, string, error)

type Daemon

type Daemon struct {
	ShutdownCtx    context.Context    // Canceled when shutdown starts.
	ShutdownCancel context.CancelFunc // Cancels the shutdownCtx to indicate shutdown starting.
	ShutdownDoneCh chan error         // Receives the result of the d.Stop() function and tells the daemon to end.
	// contains filtered or unexported fields
}

func NewDaemon

func NewDaemon() *Daemon

func (*Daemon) Authorizer

func (d *Daemon) Authorizer() auth.Authorizer

func (*Daemon) OIDCVerifier

func (d *Daemon) OIDCVerifier() *oidc.Verifier

func (*Daemon) ReloadConfig

func (d *Daemon) ReloadConfig(init bool, newCfg api.SystemConfig) (_err error)

func (*Daemon) ServerCert

func (d *Daemon) ServerCert() *incusTLS.CertInfo

func (*Daemon) Start

func (d *Daemon) Start() error

func (*Daemon) Stop

func (d *Daemon) Stop(ctx context.Context) error

func (*Daemon) TrustedFingerprints

func (d *Daemon) TrustedFingerprints() []string

Jump to

Keyboard shortcuts

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