Documentation
¶
Overview ¶
Package authmw provides a shared HTTP middleware-wrapping helper for request-based authenticators (basic, github, hmac).
It is a dependency-free leaf package: the root http package imports basic/github/hmac to build handlers from config, so those adapter packages cannot import the root http package (or anything that does) without an import cycle. authmw has no such dependency, so any of them can import it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶
func Wrap(authenticate AuthRequestFunc, next http.Handler, onError func(w http.ResponseWriter, r *http.Request, err error)) http.Handler
Wrap adapts authenticate into an http.Handler wrapping next: on each request it calls authenticate; on error, onError writes the response and the chain stops there; on success, next runs with the authenticated context.
Types ¶
Click to show internal directories.
Click to hide internal directories.