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

Unified Diff: go/auth/auth.go

Issue 779633003: CT Google Storage utils to download/upload artifacts for workers (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: goimports Created 6 years 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: go/auth/auth.go
diff --git a/go/auth/auth.go b/go/auth/auth.go
index fdf6846894d4708d39022b275e5896e5feafa828..bc4a429947e49925e16ff4839ff5f579643b8870 100644
--- a/go/auth/auth.go
+++ b/go/auth/auth.go
@@ -13,20 +13,29 @@ import (
const (
// TIMEOUT is the http timeout when making Google Storage requests.
TIMEOUT = time.Duration(time.Minute)
+ // Supported Cloud storage API OAuth scopes.
+ SCOPE_READ_ONLY = "https://www.googleapis.com/auth/devstorage.read_only"
+ SCOPE_READ_WRITE = "https://www.googleapis.com/auth/devstorage.read_write"
+ SCOPE_FULL_CONTROL = "https://www.googleapis.com/auth/devstorage.full_control"
)
// DefaultOAuthConfig returns the default configuration for oauth.
// If the given path for the cachefile is empty a default value is
// used.
func DefaultOAuthConfig(cacheFilePath string) *oauth.Config {
+ return OAuthConfig(cacheFilePath, SCOPE_READ_ONLY)
+}
+
+// OAuthConfig returns a configuration for oauth with the specified scope.
+// If the given path for the cachefile is empty a default value is used.
+func OAuthConfig(cacheFilePath, scope string) *oauth.Config {
if cacheFilePath == "" {
cacheFilePath = "google_storage_token.data"
}
-
return &oauth.Config{
ClientId: "470362608618-nlbqngfl87f4b3mhqqe9ojgaoe11vrld.apps.googleusercontent.com",
ClientSecret: "J4YCkfMXFJISGyuBuVEiH60T",
- Scope: "https://www.googleapis.com/auth/devstorage.read_only",
+ Scope: scope,
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://accounts.google.com/o/oauth2/token",
RedirectURL: "urn:ietf:wg:oauth:2.0:oob",
« ct/go/util/gs_test.go ('K') | « ct/go/util/testdata/testupload/10ktest/alexa2-2.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698