Hello community,
here is the log from the commit of package python-google-auth-oauthlib for
openSUSE:Factory checked in at 2019-10-08 19:59:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-google-auth-oauthlib (Old)
and /work/SRC/openSUSE:Factory/.python-google-auth-oauthlib.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-google-auth-oauthlib"
Tue Oct 8 19:59:20 2019 rev:3 rq:736031 version:0.4.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-google-auth-oauthlib/python-google-auth-oauthlib.changes
2019-09-27 14:46:45.721027878 +0200
+++
/work/SRC/openSUSE:Factory/.python-google-auth-oauthlib.new.2352/python-google-auth-oauthlib.changes
2019-10-08 19:59:22.443938065 +0200
@@ -1,0 +2,6 @@
+Tue Oct 8 09:01:57 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.4.1:
+ * Don't auto-generate code_verifier by default. (#48)
+
+-------------------------------------------------------------------
Old:
----
google-auth-oauthlib-0.4.0.tar.gz
New:
----
google-auth-oauthlib-0.4.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-google-auth-oauthlib.spec ++++++
--- /var/tmp/diff_new_pack.7PQ7Cg/_old 2019-10-08 19:59:23.895933716 +0200
+++ /var/tmp/diff_new_pack.7PQ7Cg/_new 2019-10-08 19:59:23.899933705 +0200
@@ -18,11 +18,10 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-google-auth-oauthlib
-Version: 0.4.0
+Version: 0.4.1
Release: 0
Summary: Google authentication library
License: Apache-2.0
-Group: Development/Languages/Python
URL:
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
Source:
https://files.pythonhosted.org/packages/source/g/google-auth-oauthlib/google-auth-oauthlib-%{version}.tar.gz
BuildRequires: %{python_module setuptools}
++++++ google-auth-oauthlib-0.4.0.tar.gz -> google-auth-oauthlib-0.4.1.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/google-auth-oauthlib-0.4.0/PKG-INFO
new/google-auth-oauthlib-0.4.1/PKG-INFO
--- old/google-auth-oauthlib-0.4.0/PKG-INFO 2019-06-11 00:26:58.000000000
+0200
+++ new/google-auth-oauthlib-0.4.1/PKG-INFO 2019-10-04 18:25:55.000000000
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: google-auth-oauthlib
-Version: 0.4.0
+Version: 0.4.1
Summary: Google Authentication Library
Home-page:
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
Author: Google Cloud Platform
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-auth-oauthlib-0.4.0/google_auth_oauthlib/flow.py
new/google-auth-oauthlib-0.4.1/google_auth_oauthlib/flow.py
--- old/google-auth-oauthlib-0.4.0/google_auth_oauthlib/flow.py 2019-06-05
01:54:16.000000000 +0200
+++ new/google-auth-oauthlib-0.4.1/google_auth_oauthlib/flow.py 2019-10-04
18:24:07.000000000 +0200
@@ -95,7 +95,8 @@
def __init__(
self, oauth2session, client_type, client_config,
- redirect_uri=None, code_verifier=None):
+ redirect_uri=None, code_verifier=None,
+ autogenerate_code_verifier=False):
"""
Args:
oauth2session (requests_oauthlib.OAuth2Session):
@@ -108,8 +109,9 @@
creation time. Otherwise, it will need to be set using
:attr:`redirect_uri`.
code_verifier (str): random string of 43-128 chars used to verify
- the key exchange.using PKCE. Auto-generated if not provided.
-
+ the key exchange.using PKCE.
+ autogenerate_code_verifier (bool): If true, auto-generate a
+ code_verifier.
.. _client secrets:
https://developers.google.com/api-client-library/python/guide
/aaa_client_secrets
@@ -122,6 +124,7 @@
"""requests_oauthlib.OAuth2Session: The OAuth 2.0 session."""
self.redirect_uri = redirect_uri
self.code_verifier = code_verifier
+ self.autogenerate_code_verifier = autogenerate_code_verifier
@classmethod
def from_client_config(cls, client_config, scopes, **kwargs):
@@ -155,12 +158,25 @@
raise ValueError(
'Client secrets must be for a web or installed app.')
+ # these args cannot be passed to requests_oauthlib.OAuth2Session
+ code_verifier = kwargs.pop('code_verifier', None)
+ autogenerate_code_verifier = kwargs.pop(
+ 'autogenerate_code_verifier', None)
+
session, client_config = (
google_auth_oauthlib.helpers.session_from_client_config(
client_config, scopes, **kwargs))
redirect_uri = kwargs.get('redirect_uri', None)
- return cls(session, client_type, client_config, redirect_uri)
+
+ return cls(
+ session,
+ client_type,
+ client_config,
+ redirect_uri,
+ code_verifier,
+ autogenerate_code_verifier
+ )
@classmethod
def from_client_secrets_file(cls, client_secrets_file, scopes, **kwargs):
@@ -217,18 +233,20 @@
specify the ``state`` when constructing the :class:`Flow`.
"""
kwargs.setdefault('access_type', 'offline')
- if not self.code_verifier:
+ if self.autogenerate_code_verifier:
chars = ascii_letters+digits+'-._~'
rnd = SystemRandom()
random_verifier = [rnd.choice(chars) for _ in range(0, 128)]
self.code_verifier = ''.join(random_verifier)
- code_hash = hashlib.sha256()
- code_hash.update(str.encode(self.code_verifier))
- unencoded_challenge = code_hash.digest()
- b64_challenge = urlsafe_b64encode(unencoded_challenge)
- code_challenge = b64_challenge.decode().split('=')[0]
- kwargs.setdefault('code_challenge', code_challenge)
- kwargs.setdefault('code_challenge_method', 'S256')
+
+ if self.code_verifier:
+ code_hash = hashlib.sha256()
+ code_hash.update(str.encode(self.code_verifier))
+ unencoded_challenge = code_hash.digest()
+ b64_challenge = urlsafe_b64encode(unencoded_challenge)
+ code_challenge = b64_challenge.decode().split('=')[0]
+ kwargs.setdefault('code_challenge', code_challenge)
+ kwargs.setdefault('code_challenge_method', 'S256')
url, state = self.oauth2session.authorization_url(
self.client_config['auth_uri'], **kwargs)
@@ -347,7 +365,7 @@
authorization code. Used only by the console strategy."""
_DEFAULT_WEB_SUCCESS_MESSAGE = (
- 'The authentication flow has completed, you may close this window.')
+ 'The authentication flow has completed. You may close this window.')
def run_console(
self,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/PKG-INFO
new/google-auth-oauthlib-0.4.1/google_auth_oauthlib.egg-info/PKG-INFO
--- old/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/PKG-INFO
2019-06-11 00:26:58.000000000 +0200
+++ new/google-auth-oauthlib-0.4.1/google_auth_oauthlib.egg-info/PKG-INFO
2019-10-04 18:25:55.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: google-auth-oauthlib
-Version: 0.4.0
+Version: 0.4.1
Summary: Google Authentication Library
Home-page:
https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
Author: Google Cloud Platform
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/SOURCES.txt
new/google-auth-oauthlib-0.4.1/google_auth_oauthlib.egg-info/SOURCES.txt
--- old/google-auth-oauthlib-0.4.0/google_auth_oauthlib.egg-info/SOURCES.txt
2019-06-11 00:26:58.000000000 +0200
+++ new/google-auth-oauthlib-0.4.1/google_auth_oauthlib.egg-info/SOURCES.txt
2019-10-04 18:25:55.000000000 +0200
@@ -16,24 +16,8 @@
google_auth_oauthlib/tool/__init__.py
google_auth_oauthlib/tool/__main__.py
tests/__init__.py
-tests/__init__.pyc
tests/test_flow.py
tests/test_helpers.py
tests/test_interactive.py
tests/test_tool.py
-tests/__pycache__/__init__.cpython-35.pyc
-tests/__pycache__/__init__.cpython-36.pyc
-tests/__pycache__/__init__.cpython-37.pyc
-tests/__pycache__/test_flow.cpython-27-PYTEST.pyc
-tests/__pycache__/test_flow.cpython-35-PYTEST.pyc
-tests/__pycache__/test_flow.cpython-36-PYTEST.pyc
-tests/__pycache__/test_flow.cpython-37-PYTEST.pyc
-tests/__pycache__/test_helpers.cpython-27-PYTEST.pyc
-tests/__pycache__/test_helpers.cpython-35-PYTEST.pyc
-tests/__pycache__/test_helpers.cpython-36-PYTEST.pyc
-tests/__pycache__/test_helpers.cpython-37-PYTEST.pyc
-tests/__pycache__/test_tool.cpython-27-PYTEST.pyc
-tests/__pycache__/test_tool.cpython-35-PYTEST.pyc
-tests/__pycache__/test_tool.cpython-36-PYTEST.pyc
-tests/__pycache__/test_tool.cpython-37-PYTEST.pyc
tests/data/client_secrets.json
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/google-auth-oauthlib-0.4.0/setup.py
new/google-auth-oauthlib-0.4.1/setup.py
--- old/google-auth-oauthlib-0.4.0/setup.py 2019-06-10 22:10:52.000000000
+0200
+++ new/google-auth-oauthlib-0.4.1/setup.py 2019-10-04 18:24:07.000000000
+0200
@@ -34,7 +34,7 @@
setup(
name='google-auth-oauthlib',
- version='0.4.0',
+ version = '0.4.1',
author='Google Cloud Platform',
author_email='[email protected]',
description='Google Authentication Library',
Binary files old/google-auth-oauthlib-0.4.0/tests/__init__.pyc and
new/google-auth-oauthlib-0.4.1/tests/__init__.pyc differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/__init__.cpython-35.pyc and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/__init__.cpython-35.pyc differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/__init__.cpython-36.pyc and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/__init__.cpython-36.pyc differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/__init__.cpython-37.pyc and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/__init__.cpython-37.pyc differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-27-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_flow.cpython-27-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-35-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_flow.cpython-35-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-36-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_flow.cpython-36-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_flow.cpython-37-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_flow.cpython-37-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_helpers.cpython-27-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_helpers.cpython-27-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_helpers.cpython-35-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_helpers.cpython-35-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_helpers.cpython-36-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_helpers.cpython-36-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_helpers.cpython-37-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_helpers.cpython-37-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-27-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_tool.cpython-27-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-35-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_tool.cpython-35-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-36-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_tool.cpython-36-PYTEST.pyc
differ
Binary files
old/google-auth-oauthlib-0.4.0/tests/__pycache__/test_tool.cpython-37-PYTEST.pyc
and
new/google-auth-oauthlib-0.4.1/tests/__pycache__/test_tool.cpython-37-PYTEST.pyc
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/google-auth-oauthlib-0.4.0/tests/test_flow.py
new/google-auth-oauthlib-0.4.1/tests/test_flow.py
--- old/google-auth-oauthlib-0.4.0/tests/test_flow.py 2019-06-05
01:54:16.000000000 +0200
+++ new/google-auth-oauthlib-0.4.1/tests/test_flow.py 2019-08-26
22:21:54.000000000 +0200
@@ -88,6 +88,23 @@
def test_authorization_url(self, instance):
scope = 'scope_one'
instance.oauth2session.scope = [scope]
+ authorization_url_patch = mock.patch.object(
+ instance.oauth2session, 'authorization_url',
+ wraps=instance.oauth2session.authorization_url)
+
+ with authorization_url_patch as authorization_url_spy:
+ url, _ = instance.authorization_url(prompt='consent')
+
+ assert CLIENT_SECRETS_INFO['web']['auth_uri'] in url
+ assert scope in url
+ authorization_url_spy.assert_called_with(
+ CLIENT_SECRETS_INFO['web']['auth_uri'],
+ access_type='offline',
+ prompt='consent')
+
+ def test_authorization_url_code_verifier(self, instance):
+ scope = 'scope_one'
+ instance.oauth2session.scope = [scope]
instance.code_verifier = 'amanaplanacanalpanama'
authorization_url_patch = mock.patch.object(
instance.oauth2session, 'authorization_url',
@@ -124,9 +141,11 @@
code_challenge='2yN0TOdl0gkGwFOmtfx3f913tgEaLM2d2S0WlmG1Z6Q',
code_challenge_method='S256')
- def test_authorization_url_generated_verifier(self, instance):
+ def test_authorization_url_generated_verifier(self):
scope = 'scope_one'
- instance.oauth2session.scope = [scope]
+ instance = flow.Flow.from_client_config(
+ CLIENT_SECRETS_INFO, scopes=[scope],
+ autogenerate_code_verifier=True)
authorization_url_path = mock.patch.object(
instance.oauth2session, 'authorization_url',
wraps=instance.oauth2session.authorization_url)
@@ -241,6 +260,38 @@
self, webbrowser_mock, instance, mock_fetch_token):
auth_redirect_url = urllib.parse.urljoin(
'http://localhost:60452',
+ self.REDIRECT_REQUEST_PATH)
+
+ with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
+ future = pool.submit(partial(
+ instance.run_local_server, port=60452))
+
+ while not future.done():
+ try:
+ requests.get(auth_redirect_url)
+ except requests.ConnectionError: # pragma: NO COVER
+ pass
+
+ credentials = future.result()
+
+ assert credentials.token == mock.sentinel.access_token
+ assert credentials._refresh_token == mock.sentinel.refresh_token
+ assert credentials.id_token == mock.sentinel.id_token
+ assert webbrowser_mock.open.called
+
+ expected_auth_response = auth_redirect_url.replace('http', 'https')
+ mock_fetch_token.assert_called_with(
+ CLIENT_SECRETS_INFO['web']['token_uri'],
+ client_secret=CLIENT_SECRETS_INFO['web']['client_secret'],
+ authorization_response=expected_auth_response,
+ code_verifier=None)
+
+ @pytest.mark.webtest
+ @mock.patch('google_auth_oauthlib.flow.webbrowser', autospec=True)
+ def test_run_local_server_code_verifier(
+ self, webbrowser_mock, instance, mock_fetch_token):
+ auth_redirect_url = urllib.parse.urljoin(
+ 'http://localhost:60452',
self.REDIRECT_REQUEST_PATH)
instance.code_verifier = 'amanaplanacanalpanama'