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

Side by Side Diff: third_party/gsutil/oauth2_plugin/oauth2_plugin.py

Issue 2280023003: depot_tools: Remove third_party/gsutil (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/gsutil/oauth2_plugin/oauth2_helper.py ('k') | third_party/gsutil/pkg_util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 from boto.auth_handler import AuthHandler
2 from boto.auth_handler import NotReadyToAuthenticate
3 import oauth2_client
4 import oauth2_helper
5
6 class OAuth2Auth(AuthHandler):
7
8 capability = ['google-oauth2', 's3']
9
10 def __init__(self, path, config, provider):
11 if (provider.name == 'google'
12 and config.has_option('Credentials', 'gs_oauth2_refresh_token')):
13
14 self.oauth2_client = oauth2_helper.OAuth2ClientFromBotoConfig(config)
15
16 self.refresh_token = oauth2_client.RefreshToken(
17 self.oauth2_client,
18 config.get('Credentials', 'gs_oauth2_refresh_token'))
19 else:
20 raise NotReadyToAuthenticate()
21
22 def add_auth(self, http_request):
23 http_request.headers['Authorization'] = \
24 self.refresh_token.GetAuthorizationHeader()
OLDNEW
« no previous file with comments | « third_party/gsutil/oauth2_plugin/oauth2_helper.py ('k') | third_party/gsutil/pkg_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698