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

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

Issue 2951553002: Extend LUCI_CONTEXT["local_auth"] protocol to understand accounts. (Closed)
Patch Set: few more tests 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
« no previous file with comments | « common/auth/localauth/ctx_test.go ('k') | common/auth/localauth/server.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..16ccb661636f1f1d9d2954649b26e7afcee48a33 100644
--- a/common/auth/localauth/rpcs/getoauthtoken.go
+++ b/common/auth/localauth/rpcs/getoauthtoken.go
@@ -5,23 +5,28 @@
package rpcs
import (
- "fmt"
+ "github.com/luci/luci-go/common/errors"
)
// 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 errors.New(`field "scopes" is required`)
case len(r.Secret) == 0:
- return fmt.Errorf(`Field "secret" is required.`)
+ return errors.New(`field "secret" is required`)
}
+ // TODO(vadimsh): Uncomment when all old auth server are turned off.
+ //case r.AccountID == "":
+ // return errors.New(`field "account_id" is required`)
+ //}
return nil
}
« no previous file with comments | « common/auth/localauth/ctx_test.go ('k') | common/auth/localauth/server.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698