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

Unified Diff: common/auth/localauth/rpcs/getoauthtoken.go

Issue 2951553002: Extend LUCI_CONTEXT["local_auth"] protocol to understand accounts. (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: common/auth/localauth/rpcs/getoauthtoken.go
diff --git a/common/auth/localauth/rpcs/getoauthtoken.go b/common/auth/localauth/rpcs/getoauthtoken.go
index 7ba42d28cbc8af032e41bc538da5a45a5a7d4860..2605b4ac8407f7617a0b17f8e1b4661237615f87 100644
--- a/common/auth/localauth/rpcs/getoauthtoken.go
+++ b/common/auth/localauth/rpcs/getoauthtoken.go
@@ -10,18 +10,23 @@ import (
// GetOAuthTokenRequest is parameters for GetOAuthToken RPC call.
type GetOAuthTokenRequest struct {
- Scopes []string `json:"scopes"`
- Secret []byte `json:"secret"`
+ Scopes []string `json:"scopes"`
+ Secret []byte `json:"secret"`
+ AccountID string `json:"account_id"`
}
-// Validate checks that scopes and secret are set.
+// Validate checks that the request is structurally valid.
func (r *GetOAuthTokenRequest) Validate() error {
switch {
case len(r.Scopes) == 0:
- return fmt.Errorf(`Field "scopes" is required.`)
+ return fmt.Errorf(`field "scopes" is required`)
iannucci 2017/06/19 20:31:28 may want to use errors.New so we get a stacktrace
Vadim Sh. 2017/06/19 20:41:36 Done, though I don't really see a point in doing t
case len(r.Secret) == 0:
- return fmt.Errorf(`Field "secret" is required.`)
+ return fmt.Errorf(`field "secret" is required`)
}
+ // TODO(vadimsh): Uncomment when all old auth server are turned off.
+ //case r.AccountID == "":
+ // return fmt.Errorf(`field "account_id" is required`)
+ //}
return nil
}

Powered by Google App Engine
This is Rietveld 408576698