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

Unified Diff: tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go

Issue 2988283002: tokenserver: Allow customizing list of OAuth scopes to use for CRL fetch. (Closed)
Patch Set: Created 3 years, 5 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 | « tokenserver/api/admin/v1/pb.discovery.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go
diff --git a/tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go b/tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go
index 621e4f43ed4247757b86ab07fbd5f5ecda078a40..9e3c4f7c415425c00c63a7b7568284a3971823ec 100644
--- a/tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go
+++ b/tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go
@@ -35,8 +35,9 @@ import (
"github.com/luci/luci-go/tokenserver/api/admin/v1"
)
-// List of OAuth scopes to use for token sent to CRL endpoint.
-var crlFetchScopes = []string{
+// List of OAuth scopes to use for token sent to CRL endpoint if config doesn't
+// specify 'oauth_scopes' field.
+var crlFetchDefaultScopes = []string{
"https://www.googleapis.com/auth/userinfo.email",
}
@@ -112,7 +113,13 @@ func fetchCRL(c context.Context, cfg *admin.CertificateAuthorityConfig, knownETa
// Pick auth or non-auth transport.
var transport http.RoundTripper
if cfg.UseOauth {
- transport, err = auth.GetRPCTransport(c, auth.AsSelf, auth.WithScopes(crlFetchScopes...))
+ var scopes []string
+ if len(cfg.OauthScopes) != 0 {
+ scopes = cfg.OauthScopes
+ } else {
+ scopes = crlFetchDefaultScopes
+ }
+ transport, err = auth.GetRPCTransport(c, auth.AsSelf, auth.WithScopes(scopes...))
} else {
transport, err = auth.GetRPCTransport(c, auth.NoAuth)
}
« no previous file with comments | « tokenserver/api/admin/v1/pb.discovery.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698