| 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 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 Loading... |
| 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 } |
| OLD | NEW |