authorityhttp

package
v0.1.0-alpha.14 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 16 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

Overview

Package authorityhttp serves write lease grants and revocations over authenticated HTTPS.

It uses mTLS and is 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 returns the earliest retry time supplied with a lease handoff error.

The value is absent for other failures and contains no owner or state data.

Types

type Authorize

type Authorize = replicationauth.Authorize

Authorize maps a verified peer certificate to a trusted node or operator identity.

It must never take that identity from an HTTP field.

func NewMTLSAuthorizer

func NewMTLSAuthorizer(config MTLSConfig) (Authorize, error)

NewMTLSAuthorizer creates an authorizer for configured and verified client certificates.

type Client

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

Client requests write leases or revocations from an authenticated controller.

It cannot impersonate an owner because the handler derives Owner from its verified mTLS identity.

func NewClient

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

NewClient creates an authority client with validated server pins and redirects disabled.

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.

Use RetryAfter to extract a handoff time from an ErrLeaseActive error.

func (*Client) Revoke

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

Revoke requests lease revocation using the caller's separately authorized operator identity.

The controller advances its stored epoch; this does not shorten a certificate already held by an unreachable owner.

type ClientOptions

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

ClientOptions sets the controller endpoint, expected server certificates, and HTTP 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 authenticated lease grant and revocation requests for one controller.

It does not expose promotion because promotion must execute a deployment-specific, local history-readiness proof.

func NewHandler

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

NewHandler creates an authority handler with separate node and operator authorizers.

func (*Handler) ServeHTTP

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

ServeHTTP checks the transport and routes a lease grant or revocation request.

type HandlerConfig

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

HandlerConfig sets the lease controller and separate node and operator authorization rules.

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

MTLSConfig maps verified certificate fingerprints to trusted peer identities.

Jump to

Keyboard shortcuts

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