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

Unified Diff: gslib/third_party/oauth2_plugin/oauth2_plugin.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month 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 | « gslib/third_party/oauth2_plugin/oauth2_helper.py ('k') | gslib/third_party/protorpc/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gslib/third_party/oauth2_plugin/oauth2_plugin.py
===================================================================
--- gslib/third_party/oauth2_plugin/oauth2_plugin.py (revision 33376)
+++ gslib/third_party/oauth2_plugin/oauth2_plugin.py (working copy)
@@ -1,48 +0,0 @@
-from boto.auth_handler import AuthHandler
-from boto.auth_handler import NotReadyToAuthenticate
-import oauth2_client
-import oauth2_helper
-from gslib.cred_types import CredTypes
-
-IS_SERVICE_ACCOUNT = False
-
-class OAuth2Auth(AuthHandler):
-
- capability = ['google-oauth2', 's3']
-
- def __init__(self, path, config, provider):
- if (provider.name == 'google'
- and config.has_option('Credentials', 'gs_oauth2_refresh_token')):
- self.oauth2_client = oauth2_helper.OAuth2ClientFromBotoConfig(config)
- else:
- raise NotReadyToAuthenticate()
-
- def add_auth(self, http_request):
- http_request.headers['Authorization'] = \
- self.oauth2_client.GetAuthorizationHeader()
-
-class OAuth2ServiceAccountAuth(AuthHandler):
-
- capability = ['google-oauth2', 's3']
-
- def __init__(self, path, config, provider):
- if (provider.name == 'google'
- and config.has_option('Credentials', 'gs_service_client_id')
- and config.has_option('Credentials', 'gs_service_key_file')):
- self.oauth2_client = oauth2_helper.OAuth2ClientFromBotoConfig(config,
- cred_type=CredTypes.OAUTH2_SERVICE_ACCOUNT)
-
- # If we make it to this point, then we will later attempt to authenticate
- # as a service account based on how the boto auth plugins work. This is
- # global so that command.py can access this value once it's set.
- # TODO: replace this approach with a way to get the current plugin
- # from boto so that we don't have to have global variables.
- global IS_SERVICE_ACCOUNT
- IS_SERVICE_ACCOUNT = True
- else:
- raise NotReadyToAuthenticate()
-
- def add_auth(self, http_request):
- http_request.headers['Authorization'] = \
- self.oauth2_client.GetAuthorizationHeader()
-
« no previous file with comments | « gslib/third_party/oauth2_plugin/oauth2_helper.py ('k') | gslib/third_party/protorpc/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698