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

Side by Side Diff: examples/appengine/helloworld_standard/frontend/handler.go

Issue 2830443003: auth: Refactor how authentication methods are passed to server/auth library. (Closed)
Patch Set: fix test Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 frontend implements HTTP server that handles requests to default 5 // Package frontend implements HTTP server that handles requests to default
6 // module. 6 // module.
7 package frontend 7 package frontend
8 8
9 import ( 9 import (
10 "net/http" 10 "net/http"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 "LoginURL": loginURL, 50 "LoginURL": loginURL,
51 "LogoutURL": logoutURL, 51 "LogoutURL": logoutURL,
52 }, nil 52 }, nil
53 }, 53 },
54 } 54 }
55 55
56 // pageBase returns the middleware chain for page handlers. 56 // pageBase returns the middleware chain for page handlers.
57 func pageBase() router.MiddlewareChain { 57 func pageBase() router.MiddlewareChain {
58 return gaemiddleware.BaseProd().Extend( 58 return gaemiddleware.BaseProd().Extend(
59 templates.WithTemplates(templateBundle), 59 templates.WithTemplates(templateBundle),
60 » » auth.Use(auth.Authenticator{server.CookieAuth}), 60 » » auth.Authenticate(server.CookieAuth),
61 » » auth.Authenticate,
62 ) 61 )
63 } 62 }
64 63
65 // prpcBase returns the middleware chain for pRPC API handlers. 64 // prpcBase returns the middleware chain for pRPC API handlers.
66 func prpcBase() router.MiddlewareChain { 65 func prpcBase() router.MiddlewareChain {
67 // OAuth 2.0 with email scope is registered as a default authenticator 66 // OAuth 2.0 with email scope is registered as a default authenticator
68 // by importing "github.com/luci/luci-go/appengine/gaeauth/server". 67 // by importing "github.com/luci/luci-go/appengine/gaeauth/server".
69 // No need to setup an authenticator here. 68 // No need to setup an authenticator here.
70 // 69 //
71 // For authorization checks, we use per-service decorators; see 70 // For authorization checks, we use per-service decorators; see
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 api.InstallHandlers(r, prpcBase()) 106 api.InstallHandlers(r, prpcBase())
108 107
109 http.DefaultServeMux.Handle("/", r) 108 http.DefaultServeMux.Handle("/", r)
110 } 109 }
111 110
112 //// Handlers. 111 //// Handlers.
113 112
114 func indexPage(c *router.Context) { 113 func indexPage(c *router.Context) {
115 templates.MustRender(c.Context, c.Writer, "pages/index.html", nil) 114 templates.MustRender(c.Context, c.Writer, "pages/index.html", nil)
116 } 115 }
OLDNEW
« no previous file with comments | « examples/appengine/helloworld_flexible/frontend/main.go ('k') | milo/appengine/common/middleware.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698