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

Unified Diff: client/authcli/authcli.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
« no previous file with comments | « no previous file | common/auth/auth.go » ('j') | common/auth/internal/luci_ctx.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/authcli/authcli.go
diff --git a/client/authcli/authcli.go b/client/authcli/authcli.go
index 456a91296dd3dd74cf6a4ba63f1e91425e533775..4786c844d262fb0d36304217bbcfb215b034f6ca 100644
--- a/client/authcli/authcli.go
+++ b/client/authcli/authcli.go
@@ -503,8 +503,18 @@ func (c *contextRun) Run(a subcommands.Application, args []string, env subcomman
return ExitCodeNoValidToken
}
+ // We currently always setup a context with one account (which is also
Vadim Sh. 2017/06/19 20:16:28 it will be possible to extend authutil to selectiv
+ // default). To avoid confusion where it comes from, we name it 'authutil'.
+ // Most tools should not care how it is named, as long as it is specified as
+ // 'default_account_id' in LUCI_CONTEXT["local_auth"].
+ srv := &localauth.Server{
+ TokenGenerators: map[string]localauth.TokenGenerator{
+ "authutil": gen,
+ },
+ DefaultAccountID: "authutil",
iannucci 2017/06/19 20:31:28 should we document these names somewhere maybe?
Vadim Sh. 2017/06/19 20:41:36 Maybe.. This particular name shouldn't be hardcode
+ }
+
// Enter the environment with the local auth server.
- srv := &localauth.Server{TokenGenerator: gen}
err = localauth.WithLocalAuth(ctx, srv, func(ctx context.Context) error {
// Put the new LUCI_CONTEXT file, prepare cmd environ.
exported, err := lucictx.Export(ctx, "")
« no previous file with comments | « no previous file | common/auth/auth.go » ('j') | common/auth/internal/luci_ctx.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698