Sha256: d03e14c7d03356f7b5acf30f102eee831bc84446d7fc5ddae4de9b8818328607

Contents?: true

Size: 774 Bytes

Versions: 25

Compression:

Stored size: 774 Bytes

Contents

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()

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
libv8-5.3.332.38.5 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.3.332.38.4 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.3.332.38.3 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.3.332.38.2 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.3.332.38.1 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.3.332.38.0 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.3.332.38.0beta2 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.2.361.43.1 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.2.361.43.0 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.1.281.59.1 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.1.281.59.0 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.1.281.59.0beta3 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.0.71.48.3 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.0.71.48.2 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-5.0.71.48.0beta2 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-4.5.95.5 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-4.5.95.4 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-4.5.95.3 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-4.5.95.2 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py
libv8-4.5.95.1 vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py