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

Side by Side Diff: server/auth/auth_test.go

Issue 2873113002: auth: Remove "shared" aka "global" secrets. (Closed)
Patch Set: Created 3 years, 7 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 | « appengine/gaeauth/server/db.go ('k') | server/auth/authdb/db.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 auth 5 package auth
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net" 9 "net"
10 "net/http" 10 "net/http"
11 "net/http/httptest" 11 "net/http/httptest"
12 "testing" 12 "testing"
13 13
14 "golang.org/x/net/context" 14 "golang.org/x/net/context"
15 15
16 "github.com/luci/luci-go/server/router" 16 "github.com/luci/luci-go/server/router"
17 "github.com/luci/luci-go/server/secrets"
18 17
19 "github.com/luci/luci-go/server/auth/authdb" 18 "github.com/luci/luci-go/server/auth/authdb"
20 "github.com/luci/luci-go/server/auth/identity" 19 "github.com/luci/luci-go/server/auth/identity"
21 "github.com/luci/luci-go/server/auth/service/protocol" 20 "github.com/luci/luci-go/server/auth/service/protocol"
22 "github.com/luci/luci-go/server/auth/signing" 21 "github.com/luci/luci-go/server/auth/signing"
23 22
24 "github.com/luci/luci-go/common/errors" 23 "github.com/luci/luci-go/common/errors"
25 . "github.com/luci/luci-go/common/testing/assertions" 24 . "github.com/luci/luci-go/common/testing/assertions"
26 . "github.com/smartystreets/goconvey/convey" 25 . "github.com/smartystreets/goconvey/convey"
27 ) 26 )
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 242 }
244 243
245 func (db *fakeDB) IsAllowedOAuthClientID(c context.Context, email, clientID stri ng) (bool, error) { 244 func (db *fakeDB) IsAllowedOAuthClientID(c context.Context, email, clientID stri ng) (bool, error) {
246 return clientID == db.allowedClientID, nil 245 return clientID == db.allowedClientID, nil
247 } 246 }
248 247
249 func (db *fakeDB) IsMember(c context.Context, id identity.Identity, groups ...st ring) (bool, error) { 248 func (db *fakeDB) IsMember(c context.Context, id identity.Identity, groups ...st ring) (bool, error) {
250 return len(groups) != 0, nil 249 return len(groups) != 0, nil
251 } 250 }
252 251
253 func (db *fakeDB) SharedSecrets(c context.Context) (secrets.Store, error) {
254 return nil, errors.New("fakeDB: SharedSecrets is not implemented")
255 }
256
257 func (db *fakeDB) GetCertificates(c context.Context, id identity.Identity) (*sig ning.PublicCertificates, error) { 252 func (db *fakeDB) GetCertificates(c context.Context, id identity.Identity) (*sig ning.PublicCertificates, error) {
258 return nil, errors.New("fakeDB: GetCertificates is not implemented") 253 return nil, errors.New("fakeDB: GetCertificates is not implemented")
259 } 254 }
260 255
261 func (db *fakeDB) GetWhitelistForIdentity(c context.Context, ident identity.Iden tity) (string, error) { 256 func (db *fakeDB) GetWhitelistForIdentity(c context.Context, ident identity.Iden tity) (string, error) {
262 return "", nil 257 return "", nil
263 } 258 }
264 259
265 func (db *fakeDB) IsInWhitelist(c context.Context, ip net.IP, whitelist string) (bool, error) { 260 func (db *fakeDB) IsInWhitelist(c context.Context, ip net.IP, whitelist string) (bool, error) {
266 return whitelist == "bots" && ip.String() == "1.2.3.4", nil 261 return whitelist == "bots" && ip.String() == "1.2.3.4", nil
267 } 262 }
268 263
269 func (db *fakeDB) GetAuthServiceURL(c context.Context) (string, error) { 264 func (db *fakeDB) GetAuthServiceURL(c context.Context) (string, error) {
270 if db.authServiceURL == "" { 265 if db.authServiceURL == "" {
271 return "", errors.New("fakeDB: GetAuthServiceURL is not configur ed") 266 return "", errors.New("fakeDB: GetAuthServiceURL is not configur ed")
272 } 267 }
273 return db.authServiceURL, nil 268 return db.authServiceURL, nil
274 } 269 }
275 270
276 func (db *fakeDB) GetTokenServiceURL(c context.Context) (string, error) { 271 func (db *fakeDB) GetTokenServiceURL(c context.Context) (string, error) {
277 if db.tokenServiceURL == "" { 272 if db.tokenServiceURL == "" {
278 return "", errors.New("fakeDB: GetTokenServiceURL is not configu red") 273 return "", errors.New("fakeDB: GetTokenServiceURL is not configu red")
279 } 274 }
280 return db.tokenServiceURL, nil 275 return db.tokenServiceURL, nil
281 } 276 }
OLDNEW
« no previous file with comments | « appengine/gaeauth/server/db.go ('k') | server/auth/authdb/db.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698