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) }) }
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) }) }
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) }) }
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) }) }