| 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/server/router" | 8 "github.com/luci/luci-go/server/router" |
| 9 "github.com/luci/luci-go/server/settings/admin" | 9 "github.com/luci/luci-go/server/settings/admin" |
| 10 | 10 |
| 11 gaeauth "github.com/luci/luci-go/appengine/gaeauth/server" | 11 gaeauth "github.com/luci/luci-go/appengine/gaeauth/server" |
| 12 "github.com/luci/luci-go/appengine/tsmon" | 12 "github.com/luci/luci-go/appengine/tsmon" |
| 13 "github.com/luci/luci-go/luci_config/appengine/gaeconfig" |
| 13 ) | 14 ) |
| 14 | 15 |
| 15 // InstallHandlers installs HTTP handlers for various default routes. | 16 // InstallHandlers installs HTTP handlers for various default routes. |
| 16 // | 17 // |
| 17 // These routes are needed for various services provided in BaseProd context to | 18 // These routes are needed for various services provided in BaseProd context to |
| 18 // work (e.g. authentication related routes, time series monitoring, etc). | 19 // work (e.g. authentication related routes, time series monitoring, etc). |
| 19 // | 20 // |
| 20 // 'base' is expected to be BaseProd() or its derivative. It must NOT do any | 21 // 'base' is expected to be BaseProd() or its derivative. It must NOT do any |
| 21 // interception of requests (e.g. checking and rejecting unauthenticated | 22 // interception of requests (e.g. checking and rejecting unauthenticated |
| 22 // requests). It may inject additional state in the context though, if it is | 23 // requests). It may inject additional state in the context though, if it is |
| 23 // needed by various tsmon callbacks or settings pages. | 24 // needed by various tsmon callbacks or settings pages. |
| 24 // | 25 // |
| 25 // In majority of cases 'base' should just be BaseProd(). If unsure what to use, | 26 // In majority of cases 'base' should just be BaseProd(). If unsure what to use, |
| 26 // use BaseProd(). | 27 // use BaseProd(). |
| 27 func InstallHandlers(r *router.Router, base router.MiddlewareChain) { | 28 func InstallHandlers(r *router.Router, base router.MiddlewareChain) { |
| 28 gaeauth.InstallHandlers(r, base) | 29 gaeauth.InstallHandlers(r, base) |
| 29 tsmon.InstallHandlers(r, base) | 30 tsmon.InstallHandlers(r, base) |
| 30 admin.InstallHandlers(r, base, &gaeauth.UsersAPIAuthMethod{}) | 31 admin.InstallHandlers(r, base, &gaeauth.UsersAPIAuthMethod{}) |
| 32 gaeconfig.InstallCacheCronHandler(r, base.Extend(RequireCron)) |
| 31 } | 33 } |
| OLD | NEW |