Documentation
¶
Overview ¶
Package auth wires gateway-supplied identity headers (X-Org-Id, X-User-Id, X-User-Email) into request context. commerced does not validate JWTs itself — hanzoai/gateway already did that. The middleware is the trust boundary: in production, only the gateway can reach commerced, and COMMERCED_REQUIRE_IDENTITY=true rejects any request without identity headers.
Index ¶
Constants ¶
const ( HeaderOrgID = "X-Org-Id" HeaderUserID = "X-User-Id" HeaderUserEmail = "X-User-Email" )
Header names — vendor-free X-* convention (see /Users/z/work/hanzo/CLAUDE.md).
Variables ¶
This section is empty.
Functions ¶
func Gin ¶
func Gin(require bool) gin.HandlerFunc
Gin returns a Gin middleware that mirrors RequireIdentity. Used by pkg/commerce/server.go to gate the /v1/commerce and /_/commerce groups.
func RequireIdentity ¶
RequireIdentity reads identity headers and attaches them to ctx. When require=true and no headers are present, responds 401. When require=false, missing headers yield empty ctx values — the embedded/dev path.
Types ¶
This section is empty.