| Index: third_party/gsutil/oauth2_plugin/oauth2_plugin.py
 | 
| diff --git a/third_party/gsutil/oauth2_plugin/oauth2_plugin.py b/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..83fe40a718b88a59b3e6fab75475ca166eeb9156
 | 
| --- /dev/null
 | 
| +++ b/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
 | 
| @@ -0,0 +1,24 @@
 | 
| +from boto.auth_handler import AuthHandler
 | 
| +from boto.auth_handler import NotReadyToAuthenticate 
 | 
| +import oauth2_client
 | 
| +import oauth2_helper
 | 
| +
 | 
| +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)
 | 
| +
 | 
| +      self.refresh_token = oauth2_client.RefreshToken(
 | 
| +          self.oauth2_client,
 | 
| +          config.get('Credentials', 'gs_oauth2_refresh_token'))
 | 
| +    else:
 | 
| +      raise NotReadyToAuthenticate()
 | 
| +
 | 
| +  def add_auth(self, http_request):
 | 
| +    http_request.headers['Authorization'] = \
 | 
| +        self.refresh_token.GetAuthorizationHeader()
 | 
| 
 |