Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package gaemiddleware | 5 package gaemiddleware |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "github.com/luci/luci-go/common/runtime/profiling" | |
| 9 "github.com/luci/luci-go/server/auth" | |
| 8 "github.com/luci/luci-go/server/router" | 10 "github.com/luci/luci-go/server/router" |
| 9 "github.com/luci/luci-go/server/settings/admin" | 11 "github.com/luci/luci-go/server/settings/admin" |
| 10 | 12 |
| 11 gaeauth "github.com/luci/luci-go/appengine/gaeauth/server" | 13 gaeauth "github.com/luci/luci-go/appengine/gaeauth/server" |
| 12 "github.com/luci/luci-go/appengine/tsmon" | 14 "github.com/luci/luci-go/appengine/tsmon" |
| 13 ) | 15 ) |
| 14 | 16 |
| 15 // InstallHandlers installs HTTP handlers for various default routes. | 17 // InstallHandlers installs HTTP handlers for various default routes. |
| 16 // | 18 // |
| 17 // These routes are needed for various services provided in BaseProd context to | 19 // These routes are needed for various services provided in BaseProd context to |
| 18 // work (e.g. authentication related routes, time series monitoring, etc). | 20 // work (e.g. authentication related routes, time series monitoring, etc). |
| 19 // | 21 // |
| 20 // 'base' is expected to be BaseProd() or its derivative. It must NOT do any | 22 // 'base' is expected to be BaseProd() or its derivative. It must NOT do any |
| 21 // interception of requests (e.g. checking and rejecting unauthenticated | 23 // interception of requests (e.g. checking and rejecting unauthenticated |
| 22 // requests). It may inject additional state in the context though, if it is | 24 // requests). It may inject additional state in the context though, if it is |
| 23 // needed by various tsmon callbacks or settings pages. | 25 // needed by various tsmon callbacks or settings pages. |
| 24 // | 26 // |
| 25 // In majority of cases 'base' should just be BaseProd(). If unsure what to use, | 27 // In majority of cases 'base' should just be BaseProd(). If unsure what to use, |
| 26 // use BaseProd(). | 28 // use BaseProd(). |
| 27 func InstallHandlers(r *router.Router, base router.MiddlewareChain) { | 29 func InstallHandlers(r *router.Router, base router.MiddlewareChain) { |
|
Vadim Sh.
2016/12/18 22:44:37
this thing is supposed to be used only on 'default
| |
| 28 gaeauth.InstallHandlers(r, base) | 30 gaeauth.InstallHandlers(r, base) |
| 29 tsmon.InstallHandlers(r, base) | 31 tsmon.InstallHandlers(r, base) |
| 30 admin.InstallHandlers(r, base, &gaeauth.UsersAPIAuthMethod{}) | 32 admin.InstallHandlers(r, base, &gaeauth.UsersAPIAuthMethod{}) |
| 33 | |
| 34 profiling.InstallHandlers(r, base.Extend( | |
| 35 auth.Autologin, | |
| 36 RequireSuperuser)) | |
| 31 } | 37 } |
| OLD | NEW |