Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Unified Diff: appengine/ephelper/middleware.go

Issue 1750143003: Remove ephelper and other endpoints code. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/ephelper/errors.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/ephelper/middleware.go
diff --git a/appengine/ephelper/middleware.go b/appengine/ephelper/middleware.go
deleted file mode 100644
index 4e2bbe11f4fa0032f17764bb48fea759c0992145..0000000000000000000000000000000000000000
--- a/appengine/ephelper/middleware.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package ephelper
-
-import (
- "github.com/GoogleCloudPlatform/go-endpoints/endpoints"
- gaeauth "github.com/luci/luci-go/appengine/gaeauth/server"
- "github.com/luci/luci-go/appengine/gaemiddleware"
- "github.com/luci/luci-go/server/auth"
- "golang.org/x/net/context"
-)
-
-// Middleware is a Context manipulation function that is called when
-// initializing a ServiceBase.
-type Middleware func(context.Context) (context.Context, error)
-
-// TestMode is a no-op middleware layer.
-var TestMode = []Middleware{}
-
-// DefaultMiddleware is the default middleware stack for a ServiceBase. It:
-//
-// - Installs the AppEngine production service base from
-// gaemiddleware.WithProd.
-// - Installs and authenticates the using the Authenticator methods from the
-// ServiceBase.
-func DefaultMiddleware(a auth.Authenticator) Middleware {
- return func(c context.Context) (context.Context, error) {
- c = gaemiddleware.WithProd(c, endpoints.HTTPRequest(c))
-
- a := a
- if a == nil {
- mi := MethodInfo(c)
- a = auth.Authenticator{
- &gaeauth.OAuth2Method{Scopes: mi.Scopes},
- }
- }
- c = auth.SetAuthenticator(c, a)
- return a.Authenticate(c, endpoints.HTTPRequest(c))
- }
-}
« no previous file with comments | « appengine/ephelper/errors.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698