Documentation
¶
Overview ¶
Package middleware holds the control-plane API server's net/http middleware (ADR-0018). authn resolves a static bearer token / scoped API key to an auth.Identity and gates every API request; unauthenticated requests get 401 problem+json. The spec/docs endpoints stay public.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authn ¶
func Authn(creds CredentialStore) func(http.Handler) http.Handler
Authn returns middleware that authenticates each request: it reads the bearer token (Authorization: Bearer <t>) or the X-Api-Key header, resolves it via creds, and puts the Identity in the request context. Missing/unknown credentials → 401 problem+json (public spec/docs paths pass through).
Types ¶
type CredentialStore ¶
CredentialStore resolves an opaque bearer token / API key to an Identity. It returns fault.Unauthorized if the credential is unknown. The V1 implementation is an in-memory map built from config (NewStaticCredentials); OIDC is a V2 follow-on.
func NewStaticCredentials ¶
func NewStaticCredentials(byToken map[string]auth.Identity) CredentialStore
NewStaticCredentials builds an in-memory CredentialStore from a token→Identity map.