Documentation
¶
Overview ¶
Package importmeta lets administrators preserve origin metadata when migrating artifacts from another repository manager.
An upload may carry the header X-OA-Import-Created-At (RFC 3339) holding the time the artifact was originally created. The header is honored only for principals holding the global "manage" permission; for everyone else it is silently ignored, so ordinary clients can never back-date or forward-date their uploads. An authorized request with a malformed or future timestamp is rejected with 400.
Middleware resolves the header once per request and stores the verdict in the request context; upload handlers read it with CreatedAt.
Index ¶
Constants ¶
const HeaderCreatedAt = "X-Oa-Import-Created-At"
HeaderCreatedAt carries the origin creation time of an uploaded artifact.
Variables ¶
This section is empty.
Functions ¶
func CreatedAt ¶
CreatedAt returns the origin creation time authorized for this request, or the zero time when there is none and the upload should be stamped "now".
func Middleware ¶
func Middleware(authz Authorizer) func(http.Handler) http.Handler
Middleware resolves X-OA-Import-Created-At for every request that carries it. It must run after authentication so the principal is in the context.