瀏覽代碼

[auth] cleanup old code.google.com oauth scope usage.

R=vadimsh@chromium.org

Change-Id: Iab38f0cf29594e20883e62e1ed113bc36a884ea4
Reviewed-on: https://chromium-review.googlesource.com/1020298
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Andrii Shyshkalov 7 年之前
父節點
當前提交
741afe8c93
共有 1 個文件被更改,包括 2 次插入10 次删除
  1. 2 10
      auth.py

+ 2 - 10
auth.py

@@ -52,11 +52,6 @@ OAUTH_SCOPE_GERRIT = 'https://www.googleapis.com/auth/gerritcodereview'
 # Deprecated. Use OAUTH_SCOPE_EMAIL instead.
 # Deprecated. Use OAUTH_SCOPE_EMAIL instead.
 OAUTH_SCOPES = OAUTH_SCOPE_EMAIL
 OAUTH_SCOPES = OAUTH_SCOPE_EMAIL
 
 
-# Additional OAuth scopes.
-ADDITIONAL_SCOPES = {
-  'code.google.com': 'https://www.googleapis.com/auth/projecthosting',
-}
-
 # Path to a file with cached OAuth2 credentials used by default relative to the
 # Path to a file with cached OAuth2 credentials used by default relative to the
 # home dir (see _get_token_cache_path). It should be a safe location accessible
 # home dir (see _get_token_cache_path). It should be a safe location accessible
 # only to a current user: knowing content of this file is roughly equivalent to
 # only to a current user: knowing content of this file is roughly equivalent to
@@ -389,13 +384,14 @@ def auth_config_to_command_options(auth_config):
   return opts
   return opts
 
 
 
 
-def get_authenticator_for_host(hostname, config):
+def get_authenticator_for_host(hostname, config, scopes=OAUTH_SCOPE_EMAIL):
   """Returns Authenticator instance to access given host.
   """Returns Authenticator instance to access given host.
 
 
   Args:
   Args:
     hostname: a naked hostname or http(s)://<hostname>[/] URL. Used to derive
     hostname: a naked hostname or http(s)://<hostname>[/] URL. Used to derive
         a cache key for token cache.
         a cache key for token cache.
     config: AuthConfig instance.
     config: AuthConfig instance.
+    scopes: space separated oauth scopes. Defaults to OAUTH_SCOPE_EMAIL.
 
 
   Returns:
   Returns:
     Authenticator object.
     Authenticator object.
@@ -407,11 +403,7 @@ def get_authenticator_for_host(hostname, config):
   # Append some scheme, otherwise urlparse puts hostname into parsed.path.
   # Append some scheme, otherwise urlparse puts hostname into parsed.path.
   if '://' not in hostname:
   if '://' not in hostname:
     hostname = 'https://' + hostname
     hostname = 'https://' + hostname
-  # TODO(tandrii): this is horrible.
-  scopes = OAUTH_SCOPES
   parsed = urlparse.urlparse(hostname)
   parsed = urlparse.urlparse(hostname)
-  if parsed.netloc in ADDITIONAL_SCOPES:
-    scopes = "%s %s" % (scopes, ADDITIONAL_SCOPES[parsed.netloc])
 
 
   if parsed.path or parsed.params or parsed.query or parsed.fragment:
   if parsed.path or parsed.params or parsed.query or parsed.fragment:
     raise AuthenticationError(
     raise AuthenticationError(