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

Side by Side Diff: server/auth/authtest/method.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
« no previous file with comments | « server/auth/auth_test.go ('k') | server/auth/authtest/state.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 authtest 5 package authtest
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "net/http" 9 "net/http"
10 "net/url" 10 "net/url"
(...skipping 15 matching lines...) Expand all
26 // Authenticate returns predefined User object (if it is not nil) or error. 26 // Authenticate returns predefined User object (if it is not nil) or error.
27 func (m FakeAuth) Authenticate(context.Context, *http.Request) (*auth.User, erro r) { 27 func (m FakeAuth) Authenticate(context.Context, *http.Request) (*auth.User, erro r) {
28 if m.User == nil { 28 if m.User == nil {
29 return nil, ErrAuthenticationError 29 return nil, ErrAuthenticationError
30 } 30 }
31 return m.User, nil 31 return m.User, nil
32 } 32 }
33 33
34 // LoginURL returns fake login URL. 34 // LoginURL returns fake login URL.
35 func (m FakeAuth) LoginURL(c context.Context, dest string) (string, error) { 35 func (m FakeAuth) LoginURL(c context.Context, dest string) (string, error) {
36 » return "http://fake/login?dest=" + url.QueryEscape(dest), nil 36 » return "http://fake.example.com/login?dest=" + url.QueryEscape(dest), ni l
37 } 37 }
38 38
39 // LogoutURL returns fake logout URL. 39 // LogoutURL returns fake logout URL.
40 func (m FakeAuth) LogoutURL(c context.Context, dest string) (string, error) { 40 func (m FakeAuth) LogoutURL(c context.Context, dest string) (string, error) {
41 » return "http://fake/logout?dest=" + url.QueryEscape(dest), nil 41 » return "http://fake.example.com/logout?dest=" + url.QueryEscape(dest), n il
42 } 42 }
OLDNEW
« no previous file with comments | « server/auth/auth_test.go ('k') | server/auth/authtest/state.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698