Esempio n. 1
0
func token(next verigo.ContextHandler) verigo.ContextHandler {
	return verigo.ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) {
		log.Infof(ctx, "Token Middleware")
		ctx = context.WithValue(ctx, "token", "ok")
		next.ServeHTTPContext(ctx, rw, req)
	})
}
Esempio n. 2
0
func acl(next verigo.ContextHandler) verigo.ContextHandler {
	return verigo.ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) {
		log.Infof(ctx, "ACL Middleware")
		ctx = context.WithValue(ctx, "acl", 1)
		next.ServeHTTPContext(ctx, rw, req)
	})
}
Esempio n. 3
0
func validation(next verigo.ContextHandler) verigo.ContextHandler {
	return verigo.ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) {
		log.Infof(ctx, "Validation Middleware")
		if req.FormValue("ok") == "false" {
			http.Error(rw, http.StatusText(400), http.StatusBadRequest)
			return
		}
		ctx = context.WithValue(ctx, "valid", true)
		next.ServeHTTPContext(ctx, rw, req)
	})
}
Esempio n. 4
0
func gae(next verigo.ContextHandler) verigo.ContextHandler {
	return verigo.ContextHandlerFunc(func(ctx context.Context, rw http.ResponseWriter, req *http.Request) {
		ctx = appengine.NewContext(req)
		next.ServeHTTPContext(ctx, rw, req)
	})
}