Documentation
¶
Overview ¶
Package middleware holds HTTP middleware specific to the RA.
Ownership enforcement lives here because it's a cross-cutting concern every agent-scoped route needs — putting it in the handlers would force every handler to duplicate the store lookup + owner check.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentFromContext ¶
func AgentFromContext(ctx context.Context) (*domain.AgentRegistration, bool)
AgentFromContext returns the ownership-verified agent attached by Ownership middleware. Handlers call this instead of re-querying the store, ensuring they never operate on an agent they didn't prove ownership of.
func ReadOwnership ¶
ReadOwnership returns middleware appropriate for GET handlers. A missing-or-not-owned agent produces 404 — the V2 spec deliberately collapses "doesn't exist" and "not yours" to hide existence from unauthorized callers.
func WriteOwnership ¶
WriteOwnership returns middleware appropriate for write (POST/DELETE) handlers. Missing agent → 404; present but not owned → 403. Writes use the explicit split because a 404-for-not-owned would hide a real authorization failure from operators investigating permissions.
Types ¶
This section is empty.