server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Phase 105 (V1.2) — dev-only bootstrap endpoint.

BootstrapHandler is mounted at POST /v1/dev/bootstrap.json on harbor dev and harbor console only. It mints a fresh dev token and returns the full connection envelope so the Console Settings page can offer a one-click "Attach to local Runtime" button.

The endpoint is loopback-gated: only localhost peers receive a 200. Non-loopback peers get 403 regardless of headers. The gate reads r.RemoteAddr directly — no header-based spoofing vector exists.

The endpoint is never registered by harbor serve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapHandler

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

BootstrapHandler serves POST /v1/dev/bootstrap.json.

func NewBootstrapHandler

func NewBootstrapHandler(
	signer BootstrapSigner,
	id identity.Identity,
	scopes []string,
	baseURL string,
	logger *slog.Logger,
) *BootstrapHandler

NewBootstrapHandler returns a handler wired for the dev identity triple and scope set. baseURL is the absolute URL the bootstrapping Console should target (populated from the actual listener address).

func (*BootstrapHandler) ServeHTTP

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

type BootstrapResponse

type BootstrapResponse struct {
	BaseURL         string            `json:"base_url"`
	Token           string            `json:"token"`
	Identity        bootstrapIdentity `json:"identity"`
	Scopes          []string          `json:"scopes"`
	ProtocolVersion string            `json:"protocol_version"`
}

BootstrapResponse is the JSON envelope returned by the bootstrap endpoint. It carries every field the Console's attachConnection helper needs for a one-click attach.

type BootstrapSigner

type BootstrapSigner interface {
	SignDevToken(now time.Time, tenant, user, session string, scopes []string) (string, error)
}

BootstrapSigner is the minimal token-signing surface the bootstrap handler needs. The harbor dev cmd's devSigner satisfies it.

Jump to

Keyboard shortcuts

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