authorityhttp

package
v0.1.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package authorityhttp exposes a narrow, mTLS-authenticated primary-lease Authority control endpoint. It is intentionally separate from the public database HTTP/RPC surface and from the quorum-member LeaseStore endpoint.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHTTPSRequired means the client did not obtain a verified, pinned HTTPS
	// response. It is fatal for a caller: treating it as a temporary controller
	// outage could hide an identity configuration error.
	ErrHTTPSRequired = errors.New("meldbase authority HTTP: verified pinned HTTPS is required")
	// ErrProtocol means an authenticated peer violated this strict control-plane
	// protocol. It is fatal for a caller and never permits a blind retry.
	ErrProtocol = errors.New("meldbase authority HTTP: invalid protocol response")
)

Functions

func RetryAfter

func RetryAfter(err error) (time.Time, bool)

RetryAfter extracts the retry point returned with ErrLeaseActive. The value is intentionally absent for all other failures and has no owner/state data.

Types

type Authorize

type Authorize = replicationauth.Authorize

Authorize returns an identity derived from a verified server-to-server peer certificate. It must never take that identity from an HTTP field.

func NewMTLSAuthorizer

func NewMTLSAuthorizer(config MTLSConfig) (Authorize, error)

type Client

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

Client is a node or operator control-plane client. It cannot impersonate an owner because the handler derives Owner from its verified mTLS identity.

func NewClient

func NewClient(options ClientOptions) (*Client, error)

func (*Client) Grant

func (client *Client) Grant(ctx context.Context, databaseID [16]byte, commitSequence uint64) (primarylease.Grant, error)

Grant requests a primary certificate for the caller's configured mTLS node identity. RetryAfter is set only when ErrLeaseActive is returned.

func (*Client) Revoke

func (client *Client) Revoke(ctx context.Context, databaseID [16]byte, epoch uint64) error

Revoke requests a controller-side epoch advancement using the caller's separately authorized operator mTLS identity.

type ClientOptions

type ClientOptions struct {
	Endpoint                   string
	ExpectedServerFingerprint  string
	ExpectedServerFingerprints []string
	HTTPClient                 *http.Client
}

ClientOptions configures a private Authority API client. HTTPClient carries the caller's mTLS certificate and trusted roots. Exactly one of the legacy single pin or the rotation-aware pin list must be supplied.

type Handler

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

Handler serves one controller issuer. It does not expose promotion because promotion must execute a deployment-specific, local history-readiness proof.

func NewHandler

func NewHandler(config HandlerConfig) (*Handler, error)

func (*Handler) ServeHTTP

func (handler *Handler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type HandlerConfig

type HandlerConfig struct {
	Authority         *primarylease.Authority
	NodeAuthorize     Authorize
	OperatorAuthorize Authorize
}

HandlerConfig configures the private Authority API. NodeAuthorize maps each verified node certificate to the immutable lease Owner used by Grant. Revoke requires a separately configured operator authorizer; granting node identity alone never conveys the ability to fence another primary.

type MTLSConfig

type MTLSConfig = replicationauth.MTLSConfig

Jump to

Keyboard shortcuts

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