// Handle is a middleware that wraps your handler with http basic auth functionality
Handle is a middleware that wraps your handler with http basic auth functionality
// Handle is a middleware that wraps your handler with http basic auth functionality
func Handle(c Checker, realm string) func(http.Handler) http.Handler {
	return func(next http.Handler) http.Handler {
		return http.HandlerFunc(
			func(w http.ResponseWriter, r *http.Request) {
				u, p := extractCreds(r)
				if !c.Check(u, p) {
					unauthorized(w, realm)
					return
				}
				next.ServeHTTP(w, r)
			},
		)
	}
}
func Handle ( c Checker , realm string ) func ( http . Handler ) http . Handler { return func ( next http . Handler ) http . Handler { return http . HandlerFunc ( func ( w http . ResponseWriter , r * http . Request ) { u , p := extractCreds ( r ) if ! c . Check ( u , p ) { unauthorized ( w , realm ) return } next . ServeHTTP ( w , r ) } , ) } }
Handle is a middleware that wraps your handler with http basic auth functionality
Handle is a middleware that wraps your handler with http basic auth functionality