registrytokenhttp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package registrytokenhttp — thin HTTP transport for the IAM Docker Registry v2 auth-server: the `/iam/token` endpoint.

Transport only: parse the Docker token-auth request, delegate to the registry_token use-case (which verifies the presented BASIC ACCESS TOKEN — the only credential kind this lane accepts, задача kacho#1143 — and issues the registry token), format the Docker-compatible JSON. No business logic.

───────────────────────────────────────────────────────────────────────────── КТО ЧЕКАНИТ ТОКЕН ЭТОЙ ПОЛОСЫ — НАШ ПОДПИСАНТ, И ТОЛЬКО ОН

Здесь стояло утверждение, что токен выпускает внешний провайдер, а служба не чеканит ничего; позже — что это зависит от посадки. Оба пережили свой предмет: издатель у полосы один — НАШ подписант (internal/registrytokenwire.LocalMintAdapter поверх internal/tokensigner), и полоса без него не собирается вовсе (kaname#494). При разборе «почему плоскость данных отвергла токен» ответ на «чей это токен» поэтому один.

───────────────────────────────────────────────────────────────────────────── КЛЮЧИ ПРОВЕРКИ ЖИВУТ НЕ ЗДЕСЬ

Своего эндпоинта набора ключей у этого mux нет: плоскость данных берёт ключи у внутреннего публикатора (:9097, package internal/handler/jwksproxyhttp), и запись у него ОДНА — НАША, по пути `authn.token-signing.key-set-path` (зеркало набора провайдера снято, kaname#361).

Endpoint:

GET|POST /iam/token — Docker Registry v2 token endpoint.

Index

Constants

View Source
const TokenPath = "/iam/token"

TokenPath — the token endpoint path. MUST equal the data-plane's Bearer realm path (the WWW-Authenticate realm), so verifiers and docker clients resolve the same URL.

Variables

This section is empty.

Functions

func NewMux

func NewMux(token http.Handler) *http.ServeMux

NewMux mounts the token handler on its canonical path. The caller exposes the returned mux on an EXTERNAL-reachable HTTP listener (docker clients hit /iam/token through the edge).

Types

type Config

type Config struct {
	// Realm — the token-endpoint URL advertised in WWW-Authenticate (must match
	// the data-plane's Bearer realm, e.g. https://api.kacho.local/iam/token).
	Realm string
	// DefaultService — the service name used in WWW-Authenticate when the request
	// omits ?service= (e.g. registry.kacho.local).
	DefaultService string
	// Source — адрес источника запроса по правилу поверхности выдачи
	// (`internal/issuingsource`, Р7): ключ темпа анонимной выдачи (kaname#928).
	// nil — источник не различается, и все анонимные входы делят один ключ.
	Source func(*http.Request) string
}

Config — handler config (the WWW-Authenticate realm + default service name).

type TokenHandler

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

TokenHandler — the `/iam/token` endpoint.

func NewTokenHandler

func NewTokenHandler(cfg Config, issuer TokenIssuer) *TokenHandler

NewTokenHandler — builder.

func (*TokenHandler) ServeHTTP

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

func (*TokenHandler) WithLogger

func (h *TokenHandler) WithLogger(l *slog.Logger) *TokenHandler

WithLogger провязывает журнал причин отказа. Отдельным методом, а не полем Config: Config описывает то, что видит КЛИЕНТ (realm, имя службы), а журнал — то, что видим мы.

type TokenIssuer

type TokenIssuer interface {
	Execute(ctx context.Context, in registrytokenuc.IssueInput) (registrytokenuc.IssueOutput, error)
	ExecuteAnonymous(ctx context.Context, in registrytokenuc.AnonymousInput) (registrytokenuc.IssueOutput, error)
	AnonymousEnabled() bool
}

TokenIssuer — the registry_token use-case port the handler delegates to. Execute serves the presented-credential (Basic) path; ExecuteAnonymous brokers the public `user:*` anonymous-pull path (no Basic creds); AnonymousEnabled reports whether that path is configured (else the handler fails closed to a challenge).

Jump to

Keyboard shortcuts

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