| OLD | NEW |
| 1 # Copyright 2013 The Swarming Authors. All rights reserved. | 1 # Copyright 2013 The Swarming Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 that | 2 # Use of this source code is governed under the Apache License, Version 2.0 that |
| 3 # can be found in the LICENSE file. | 3 # can be found in the LICENSE file. |
| 4 | 4 |
| 5 """OAuth2 related utilities and implementation of browser based login flow.""" | 5 """OAuth2 related utilities and implementation of browser based login flow.""" |
| 6 | 6 |
| 7 # pylint: disable=W0613 | 7 # pylint: disable=W0613 |
| 8 | 8 |
| 9 import base64 | 9 import base64 |
| 10 import BaseHTTPServer | 10 import BaseHTTPServer |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'pyasn1')) | 28 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'pyasn1')) |
| 29 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'rsa')) | 29 sys.path.insert(0, os.path.join(ROOT_DIR, 'third_party', 'rsa')) |
| 30 | 30 |
| 31 import httplib2 | 31 import httplib2 |
| 32 import rsa | 32 import rsa |
| 33 | 33 |
| 34 from pyasn1.codec.der import decoder | 34 from pyasn1.codec.der import decoder |
| 35 from pyasn1.type import univ | 35 from pyasn1.type import univ |
| 36 | 36 |
| 37 from oauth2client import client | 37 from oauth2client import client |
| 38 from oauth2client import multistore_file | 38 from oauth2client.contrib import multistore_file |
| 39 | 39 |
| 40 from third_party import requests | 40 from third_party import requests |
| 41 from utils import tools | 41 from utils import tools |
| 42 | 42 |
| 43 | 43 |
| 44 # Path to a file with cached OAuth2 credentials used by default. Can be | 44 # Path to a file with cached OAuth2 credentials used by default. Can be |
| 45 # overridden by command line option or env variable. | 45 # overridden by command line option or env variable. |
| 46 DEFAULT_OAUTH_TOKENS_CACHE = os.path.join( | 46 DEFAULT_OAUTH_TOKENS_CACHE = os.path.join( |
| 47 os.path.expanduser('~'), '.isolated_oauth') | 47 os.path.expanduser('~'), '.isolated_oauth') |
| 48 | 48 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 self.end_headers() | 592 self.end_headers() |
| 593 query = self.path.split('?', 1)[-1] | 593 query = self.path.split('?', 1)[-1] |
| 594 query = dict(urlparse.parse_qsl(query)) | 594 query = dict(urlparse.parse_qsl(query)) |
| 595 self.server.query_params = query | 595 self.server.query_params = query |
| 596 self.wfile.write('<html><head><title>Authentication Status</title></head>') | 596 self.wfile.write('<html><head><title>Authentication Status</title></head>') |
| 597 self.wfile.write('<body><p>The authentication flow has completed.</p>') | 597 self.wfile.write('<body><p>The authentication flow has completed.</p>') |
| 598 self.wfile.write('</body></html>') | 598 self.wfile.write('</body></html>') |
| 599 | 599 |
| 600 def log_message(self, _format, *args): | 600 def log_message(self, _format, *args): |
| 601 """Do not log messages to stdout while running as command line program.""" | 601 """Do not log messages to stdout while running as command line program.""" |
| OLD | NEW |