[Python-modules-commits] [python-oauthlib] 02/05: Import python-oauthlib_2.0.4.orig.tar.gz

Daniele Tricoli eriol-guest at moszumanska.debian.org
Mon Sep 25 22:36:36 UTC 2017


This is an automated email from the git hooks/post-receive script.

eriol-guest pushed a commit to branch master
in repository python-oauthlib.

commit eea9b6c44e2d62082d8f35b00a261b9adbd65b20
Author: Daniele Tricoli <eriol at mornie.org>
Date:   Mon Sep 25 23:43:59 2017 +0200

    Import python-oauthlib_2.0.4.orig.tar.gz
---
 CHANGELOG.rst                                      |  25 +++-
 PKG-INFO                                           |  10 +-
 README.rst                                         |   4 +-
 oauthlib.egg-info/PKG-INFO                         |  10 +-
 oauthlib.egg-info/SOURCES.txt                      |   1 +
 oauthlib.egg-info/requires.txt                     |   2 +
 oauthlib/__init__.py                               |   2 +-
 oauthlib/common.py                                 |   5 +
 oauthlib/oauth1/__init__.py                        |   2 +-
 oauthlib/oauth1/rfc5849/__init__.py                |   2 +-
 oauthlib/oauth1/rfc5849/endpoints/access_token.py  |   2 +-
 oauthlib/oauth1/rfc5849/endpoints/authorization.py |   3 +-
 oauthlib/oauth1/rfc5849/endpoints/base.py          |   9 +-
 .../oauth1/rfc5849/endpoints/pre_configured.py     |   4 +-
 oauthlib/oauth1/rfc5849/endpoints/request_token.py |   2 +-
 oauthlib/oauth1/rfc5849/endpoints/resource.py      |   2 +-
 .../oauth1/rfc5849/endpoints/signature_only.py     |  11 +-
 oauthlib/oauth1/rfc5849/errors.py                  |   2 +-
 oauthlib/oauth1/rfc5849/parameters.py              |   6 +-
 oauthlib/oauth1/rfc5849/request_validator.py       |  58 ++++----
 oauthlib/oauth1/rfc5849/signature.py               |  28 +++-
 oauthlib/oauth1/rfc5849/utils.py                   |   5 +-
 oauthlib/oauth2/__init__.py                        |   2 +-
 oauthlib/oauth2/rfc6749/clients/__init__.py        |   2 +-
 .../oauth2/rfc6749/clients/backend_application.py  |   3 +-
 oauthlib/oauth2/rfc6749/clients/base.py            |  12 +-
 .../oauth2/rfc6749/clients/legacy_application.py   |   3 +-
 .../oauth2/rfc6749/clients/mobile_application.py   |   3 +-
 .../oauth2/rfc6749/clients/service_application.py  |   3 +-
 oauthlib/oauth2/rfc6749/clients/web_application.py |   6 +-
 oauthlib/oauth2/rfc6749/endpoints/authorization.py |   1 +
 oauthlib/oauth2/rfc6749/endpoints/base.py          |   4 +-
 .../oauth2/rfc6749/endpoints/pre_configured.py     |  18 +--
 oauthlib/oauth2/rfc6749/endpoints/revocation.py    |   8 +-
 oauthlib/oauth2/rfc6749/endpoints/token.py         |   1 -
 oauthlib/oauth2/rfc6749/errors.py                  | 147 ++++++++++++++++-----
 .../rfc6749/grant_types/authorization_code.py      |  11 +-
 oauthlib/oauth2/rfc6749/grant_types/base.py        |   5 +-
 .../rfc6749/grant_types/client_credentials.py      |   4 +-
 oauthlib/oauth2/rfc6749/grant_types/implicit.py    |   4 +-
 .../oauth2/rfc6749/grant_types/openid_connect.py   |  44 +++---
 .../oauth2/rfc6749/grant_types/refresh_token.py    |   4 +-
 .../resource_owner_password_credentials.py         |   4 +-
 oauthlib/oauth2/rfc6749/parameters.py              |  17 ++-
 oauthlib/oauth2/rfc6749/request_validator.py       |   2 +-
 oauthlib/oauth2/rfc6749/tokens.py                  |  11 +-
 oauthlib/oauth2/rfc6749/utils.py                   |   6 +-
 oauthlib/uri_validate.py                           |   1 +
 setup.cfg                                          |   3 +
 setup.py                                           |   9 +-
 .../oauth1/rfc5849/endpoints/test_access_token.py  |  10 +-
 .../oauth1/rfc5849/endpoints/test_authorization.py |   5 +-
 tests/oauth1/rfc5849/endpoints/test_base.py        |  14 +-
 .../oauth1/rfc5849/endpoints/test_request_token.py |   9 +-
 tests/oauth1/rfc5849/endpoints/test_resource.py    |   9 +-
 .../rfc5849/endpoints/test_signature_only.py       |   9 +-
 tests/oauth1/rfc5849/test_client.py                |   7 +-
 tests/oauth1/rfc5849/test_parameters.py            |   8 +-
 tests/oauth1/rfc5849/test_request_validator.py     |   3 +-
 tests/oauth1/rfc5849/test_signatures.py            |  58 ++++----
 tests/oauth1/rfc5849/test_utils.py                 |   4 +-
 .../rfc6749/clients/test_backend_application.py    |   2 +-
 tests/oauth2/rfc6749/clients/test_base.py          |   9 +-
 .../rfc6749/clients/test_service_application.py    |   1 -
 .../oauth2/rfc6749/clients/test_web_application.py |  12 +-
 .../oauth2/rfc6749/endpoints/test_base_endpoint.py |   9 +-
 .../rfc6749/endpoints/test_claims_handling.py      |   8 +-
 .../endpoints/test_client_authentication.py        |  12 +-
 .../endpoints/test_credentials_preservation.py     |  14 +-
 .../rfc6749/endpoints/test_error_responses.py      |  14 +-
 .../rfc6749/endpoints/test_extra_credentials.py    |   9 +-
 .../rfc6749/endpoints/test_prompt_handling.py      |  33 ++++-
 .../endpoints/test_resource_owner_association.py   |  12 +-
 .../rfc6749/endpoints/test_revocation_endpoint.py  |  39 ++++--
 .../rfc6749/endpoints/test_scope_handling.py       |  12 +-
 .../rfc6749/grant_types/test_authorization_code.py |  10 +-
 .../rfc6749/grant_types/test_client_credentials.py |   5 +-
 tests/oauth2/rfc6749/grant_types/test_implicit.py  |   3 +-
 .../rfc6749/grant_types/test_openid_connect.py     |  26 ++--
 .../rfc6749/grant_types/test_refresh_token.py      |   7 +-
 .../grant_types/test_resource_owner_password.py    |  10 +-
 tests/oauth2/rfc6749/test_parameters.py            |  10 +-
 tests/oauth2/rfc6749/test_request_validator.py     |   4 +-
 tests/oauth2/rfc6749/test_server.py                |  24 ++--
 tests/oauth2/rfc6749/test_tokens.py                |   4 +-
 tests/oauth2/rfc6749/test_utils.py                 |  14 +-
 tests/test_common.py                               |  23 ++--
 87 files changed, 626 insertions(+), 369 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 7afc875..397fc07 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,13 +1,32 @@
 Changelog
 =========
 
-Development
------------
+2.0.4 (2017-09-17)
+------------------
+* Fixed typo that caused OAuthlib to crash because of the fix in "Address missing OIDC errors and fix a typo in the AccountSelectionRequired exception".
+
+2.0.3 (2017-09-07)
+------------------
+* Address missing OIDC errors and fix a typo in the AccountSelectionRequired exception.
+* Update proxy keys on CaseInsensitiveDict.update().
+* Redirect errors according to OIDC's response_mode.
+* Added universal wheel support.
+* Added log statements to except clauses.
+* According to RC7009 Section 2.1, a client should include authentication credentials when revoking its tokens.
+  As discussed in #339, this is not make sense for public clients.
+  However, in that case, the public client should still be checked that is infact a public client (authenticate_client_id).
+* Improved prompt parameter validation.
+* Added two error codes from RFC 6750.
+* Hybrid response types are now be fragment-encoded.
+* Added Python 3.6 to Travis CI testing and trove classifiers.
+* Fixed BytesWarning issued when using a string placeholder for bytes object.
+* Documented PyJWT dependency and improved logging and exception messages.
+* Documentation improvements and fixes.
 
 2.0.2 (2017-03-19)
 ------------------
 * Dropped support for Python 2.6, 3.2 & 3.3.
-* (FIX) `OpenIDConnector` will no longer raise an AttributeError when calling `openid_authorization_validator()` twice.  
+* (FIX) `OpenIDConnector` will no longer raise an AttributeError when calling `openid_authorization_validator()` twice.
 
 2.0.1 (2016-11-23)
 ------------------
diff --git a/PKG-INFO b/PKG-INFO
index 7a883ba..ba8e424 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: oauthlib
-Version: 2.0.2
+Version: 2.0.4
 Summary: A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
 Home-page: https://github.com/idan/oauthlib
 Author: Ib Lundgren
@@ -12,9 +12,9 @@ Description: OAuthLib
         *A generic, spec-compliant, thorough implementation of the OAuth request-signing
         logic for python*
         
-        .. image:: https://travis-ci.org/idan/oauthlib.png?branch=master
+        .. image:: https://travis-ci.org/idan/oauthlib.svg?branch=master
           :target: https://travis-ci.org/idan/oauthlib
-        .. image:: https://coveralls.io/repos/idan/oauthlib/badge.png?branch=master
+        .. image:: https://coveralls.io/repos/idan/oauthlib/badge.svg?branch=master
           :target: https://coveralls.io/r/idan/oauthlib
         
         
@@ -118,10 +118,12 @@ Classifier: Operating System :: MacOS
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: POSIX :: Linux
 Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
diff --git a/README.rst b/README.rst
index 47e989c..eb85ffa 100644
--- a/README.rst
+++ b/README.rst
@@ -4,9 +4,9 @@ OAuthLib
 *A generic, spec-compliant, thorough implementation of the OAuth request-signing
 logic for python*
 
-.. image:: https://travis-ci.org/idan/oauthlib.png?branch=master
+.. image:: https://travis-ci.org/idan/oauthlib.svg?branch=master
   :target: https://travis-ci.org/idan/oauthlib
-.. image:: https://coveralls.io/repos/idan/oauthlib/badge.png?branch=master
+.. image:: https://coveralls.io/repos/idan/oauthlib/badge.svg?branch=master
   :target: https://coveralls.io/r/idan/oauthlib
 
 
diff --git a/oauthlib.egg-info/PKG-INFO b/oauthlib.egg-info/PKG-INFO
index 7a883ba..ba8e424 100644
--- a/oauthlib.egg-info/PKG-INFO
+++ b/oauthlib.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: oauthlib
-Version: 2.0.2
+Version: 2.0.4
 Summary: A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
 Home-page: https://github.com/idan/oauthlib
 Author: Ib Lundgren
@@ -12,9 +12,9 @@ Description: OAuthLib
         *A generic, spec-compliant, thorough implementation of the OAuth request-signing
         logic for python*
         
-        .. image:: https://travis-ci.org/idan/oauthlib.png?branch=master
+        .. image:: https://travis-ci.org/idan/oauthlib.svg?branch=master
           :target: https://travis-ci.org/idan/oauthlib
-        .. image:: https://coveralls.io/repos/idan/oauthlib/badge.png?branch=master
+        .. image:: https://coveralls.io/repos/idan/oauthlib/badge.svg?branch=master
           :target: https://coveralls.io/r/idan/oauthlib
         
         
@@ -118,10 +118,12 @@ Classifier: Operating System :: MacOS
 Classifier: Operating System :: POSIX
 Classifier: Operating System :: POSIX :: Linux
 Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
diff --git a/oauthlib.egg-info/SOURCES.txt b/oauthlib.egg-info/SOURCES.txt
index 35edb24..c54d8fc 100644
--- a/oauthlib.egg-info/SOURCES.txt
+++ b/oauthlib.egg-info/SOURCES.txt
@@ -2,6 +2,7 @@ CHANGELOG.rst
 LICENSE
 MANIFEST.in
 README.rst
+setup.cfg
 setup.py
 oauthlib/__init__.py
 oauthlib/common.py
diff --git a/oauthlib.egg-info/requires.txt b/oauthlib.egg-info/requires.txt
index 50fb2a3..098d291 100644
--- a/oauthlib.egg-info/requires.txt
+++ b/oauthlib.egg-info/requires.txt
@@ -11,6 +11,8 @@ pyjwt>=1.0.0
 
 [test]
 nose
+unittest2
 cryptography
+mock
 pyjwt>=1.0.0
 blinker
diff --git a/oauthlib/__init__.py b/oauthlib/__init__.py
index e5186a3..9121582 100644
--- a/oauthlib/__init__.py
+++ b/oauthlib/__init__.py
@@ -10,7 +10,7 @@
 """
 
 __author__ = 'Idan Gazit <idan at gazit.me>'
-__version__ = '2.0.2'
+__version__ = '2.0.4'
 
 
 import logging
diff --git a/oauthlib/common.py b/oauthlib/common.py
index 5d999b2..705cbd2 100644
--- a/oauthlib/common.py
+++ b/oauthlib/common.py
@@ -354,6 +354,11 @@ class CaseInsensitiveDict(dict):
         super(CaseInsensitiveDict, self).__setitem__(k, v)
         self.proxy[k.lower()] = k
 
+    def update(self, *args, **kwargs):
+        super(CaseInsensitiveDict, self).update(*args, **kwargs)
+        for k in dict(*args, **kwargs):
+            self.proxy[k.lower()] = k
+
 
 class Request(object):
 
diff --git a/oauthlib/oauth1/__init__.py b/oauthlib/oauth1/__init__.py
index b2bc0f9..f9dff74 100644
--- a/oauthlib/oauth1/__init__.py
+++ b/oauthlib/oauth1/__init__.py
@@ -16,4 +16,4 @@ from .rfc5849.request_validator import RequestValidator
 from .rfc5849.endpoints import RequestTokenEndpoint, AuthorizationEndpoint
 from .rfc5849.endpoints import AccessTokenEndpoint, ResourceEndpoint
 from .rfc5849.endpoints import SignatureOnlyEndpoint, WebApplicationServer
-from .rfc5849.errors import *
+from .rfc5849.errors import InsecureTransportError, InvalidClientError, InvalidRequestError, InvalidSignatureMethodError, OAuth1Error
diff --git a/oauthlib/oauth1/rfc5849/__init__.py b/oauthlib/oauth1/rfc5849/__init__.py
index 997251e..06902e2 100644
--- a/oauthlib/oauth1/rfc5849/__init__.py
+++ b/oauthlib/oauth1/rfc5849/__init__.py
@@ -143,7 +143,7 @@ class Client(object):
         base_string = signature.construct_base_string(request.http_method,
                                                       normalized_uri, normalized_params)
 
-        log.debug("Base signing string: {0}".format(base_string))
+        log.debug("Signing: signature base string: {0}".format(base_string))
 
         if self.signature_method not in self.SIGNATURE_METHODS:
             raise ValueError('Invalid signature method.')
diff --git a/oauthlib/oauth1/rfc5849/endpoints/access_token.py b/oauthlib/oauth1/rfc5849/endpoints/access_token.py
index 567965a..12b901c 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/access_token.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/access_token.py
@@ -14,8 +14,8 @@ import logging
 
 from oauthlib.common import urlencode
 
-from .base import BaseEndpoint
 from .. import errors
+from .base import BaseEndpoint
 
 log = logging.getLogger(__name__)
 
diff --git a/oauthlib/oauth1/rfc5849/endpoints/authorization.py b/oauthlib/oauth1/rfc5849/endpoints/authorization.py
index a93a517..1751a45 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/authorization.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/authorization.py
@@ -10,8 +10,9 @@ from __future__ import absolute_import, unicode_literals
 
 from oauthlib.common import Request, add_params_to_uri
 
-from .base import BaseEndpoint
 from .. import errors
+from .base import BaseEndpoint
+
 try:
     from urllib import urlencode
 except ImportError:
diff --git a/oauthlib/oauth1/rfc5849/endpoints/base.py b/oauthlib/oauth1/rfc5849/endpoints/base.py
index 42d9363..9d51e69 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/base.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/base.py
@@ -12,12 +12,9 @@ import time
 
 from oauthlib.common import Request, generate_token
 
-from .. import signature, utils, errors
-from .. import CONTENT_TYPE_FORM_URLENCODED
-from .. import SIGNATURE_HMAC, SIGNATURE_RSA
-from .. import SIGNATURE_TYPE_AUTH_HEADER
-from .. import SIGNATURE_TYPE_QUERY
-from .. import SIGNATURE_TYPE_BODY
+from .. import (CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC, SIGNATURE_RSA,
+                SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_BODY,
+                SIGNATURE_TYPE_QUERY, errors, signature, utils)
 
 
 class BaseEndpoint(object):
diff --git a/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py b/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py
index f0705a8..f89393a 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py
@@ -1,7 +1,7 @@
 from __future__ import absolute_import, unicode_literals
 
-from . import RequestTokenEndpoint, AuthorizationEndpoint
-from . import AccessTokenEndpoint, ResourceEndpoint
+from . import (AccessTokenEndpoint, AuthorizationEndpoint,
+               RequestTokenEndpoint, ResourceEndpoint)
 
 
 class WebApplicationServer(RequestTokenEndpoint, AuthorizationEndpoint,
diff --git a/oauthlib/oauth1/rfc5849/endpoints/request_token.py b/oauthlib/oauth1/rfc5849/endpoints/request_token.py
index 4a76abc..515395b 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/request_token.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/request_token.py
@@ -14,8 +14,8 @@ import logging
 
 from oauthlib.common import urlencode
 
-from .base import BaseEndpoint
 from .. import errors
+from .base import BaseEndpoint
 
 log = logging.getLogger(__name__)
 
diff --git a/oauthlib/oauth1/rfc5849/endpoints/resource.py b/oauthlib/oauth1/rfc5849/endpoints/resource.py
index 6021627..53f9562 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/resource.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/resource.py
@@ -10,8 +10,8 @@ from __future__ import absolute_import, unicode_literals
 
 import logging
 
-from .base import BaseEndpoint
 from .. import errors
+from .base import BaseEndpoint
 
 log = logging.getLogger(__name__)
 
diff --git a/oauthlib/oauth1/rfc5849/endpoints/signature_only.py b/oauthlib/oauth1/rfc5849/endpoints/signature_only.py
index d609b7c..4297770 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/signature_only.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/signature_only.py
@@ -10,8 +10,8 @@ from __future__ import absolute_import, unicode_literals
 
 import logging
 
-from .base import BaseEndpoint
 from .. import errors
+from .base import BaseEndpoint
 
 log = logging.getLogger(__name__)
 
@@ -34,17 +34,22 @@ class SignatureOnlyEndpoint(BaseEndpoint):
         """
         try:
             request = self._create_request(uri, http_method, body, headers)
-        except errors.OAuth1Error:
+        except errors.OAuth1Error as err:
+            log.info(
+                'Exception caught while validating request, %s.' % err)
             return False, None
 
         try:
             self._check_transport_security(request)
             self._check_mandatory_parameters(request)
-        except errors.OAuth1Error:
+        except errors.OAuth1Error as err:
+            log.info(
+                'Exception caught while validating request, %s.' % err)
             return False, request
 
         if not self.request_validator.validate_timestamp_and_nonce(
                 request.client_key, request.timestamp, request.nonce, request):
+            log.debug('[Failure] verification failed: timestamp/nonce')
             return False, request
 
         # The server SHOULD return a 401 (Unauthorized) status code when
diff --git a/oauthlib/oauth1/rfc5849/errors.py b/oauthlib/oauth1/rfc5849/errors.py
index 978035e..a5c59bd 100644
--- a/oauthlib/oauth1/rfc5849/errors.py
+++ b/oauthlib/oauth1/rfc5849/errors.py
@@ -8,7 +8,7 @@ defined error responses for all four core grant types.
 """
 from __future__ import unicode_literals
 
-from oauthlib.common import urlencode, add_params_to_uri
+from oauthlib.common import add_params_to_uri, urlencode
 
 
 class OAuth1Error(Exception):
diff --git a/oauthlib/oauth1/rfc5849/parameters.py b/oauthlib/oauth1/rfc5849/parameters.py
index f0963ab..dcb23dc 100644
--- a/oauthlib/oauth1/rfc5849/parameters.py
+++ b/oauthlib/oauth1/rfc5849/parameters.py
@@ -9,12 +9,14 @@ This module contains methods related to `section 3.5`_ of the OAuth 1.0a spec.
 """
 from __future__ import absolute_import, unicode_literals
 
+from oauthlib.common import extract_params, urlencode
+
+from . import utils
+
 try:
     from urlparse import urlparse, urlunparse
 except ImportError:
     from urllib.parse import urlparse, urlunparse
-from . import utils
-from oauthlib.common import extract_params, urlencode
 
 
 # TODO: do we need filter_params now that oauth_params are handled by Request?
diff --git a/oauthlib/oauth1/rfc5849/request_validator.py b/oauthlib/oauth1/rfc5849/request_validator.py
index 30a3694..2ccb367 100644
--- a/oauthlib/oauth1/rfc5849/request_validator.py
+++ b/oauthlib/oauth1/rfc5849/request_validator.py
@@ -8,6 +8,8 @@ for signing and checking OAuth 1.0 RFC 5849 requests.
 """
 from __future__ import absolute_import, unicode_literals
 
+import sys
+
 from . import SIGNATURE_METHODS, utils
 
 
@@ -197,6 +199,14 @@ class RequestValidator(object):
         """Check that the realm is one of a set allowed realms."""
         return all((r in self.realms for r in realms))
 
+    def _subclass_must_implement(self, fn):
+        """
+        Returns a NotImplementedError for a function that should be implemented.
+        :param fn: name of the function
+        """
+        m = "Missing function implementation in {}: {}".format(type(self), fn)
+        return NotImplementedError(m)
+
     @property
     def dummy_client(self):
         """Dummy client used when an invalid client key is supplied.
@@ -219,7 +229,7 @@ class RequestValidator(object):
         * ResourceEndpoint
         * SignatureOnlyEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("dummy_client")
 
     @property
     def dummy_request_token(self):
@@ -235,7 +245,7 @@ class RequestValidator(object):
 
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("dummy_request_token")
 
     @property
     def dummy_access_token(self):
@@ -251,7 +261,7 @@ class RequestValidator(object):
 
         * ResourceEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("dummy_access_token")
 
     def get_client_secret(self, client_key, request):
         """Retrieves the client secret associated with the client key.
@@ -286,7 +296,7 @@ class RequestValidator(object):
         * ResourceEndpoint
         * SignatureOnlyEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement('get_client_secret')
 
     def get_request_token_secret(self, client_key, token, request):
         """Retrieves the shared secret associated with the request token.
@@ -318,7 +328,7 @@ class RequestValidator(object):
 
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement('get_request_token_secret')
 
     def get_access_token_secret(self, client_key, token, request):
         """Retrieves the shared secret associated with the access token.
@@ -350,7 +360,7 @@ class RequestValidator(object):
 
         * ResourceEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("get_access_token_secret")
 
     def get_default_realms(self, client_key, request):
         """Get the default realms for a client.
@@ -366,7 +376,7 @@ class RequestValidator(object):
 
         * RequestTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("get_default_realms")
 
     def get_realms(self, token, request):
         """Get realms associated with a request token.
@@ -380,7 +390,7 @@ class RequestValidator(object):
         * AuthorizationEndpoint
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("get_realms")
 
     def get_redirect_uri(self, token, request):
         """Get the redirect URI associated with a request token.
@@ -397,7 +407,7 @@ class RequestValidator(object):
 
         * AuthorizationEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("get_redirect_uri")
 
     def get_rsa_key(self, client_key, request):
         """Retrieves a previously stored client provided RSA key.
@@ -420,7 +430,7 @@ class RequestValidator(object):
         * ResourceEndpoint
         * SignatureOnlyEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("get_rsa_key")
 
     def invalidate_request_token(self, client_key, request_token, request):
         """Invalidates a used request token.
@@ -446,7 +456,7 @@ class RequestValidator(object):
 
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("invalidate_request_token")
 
     def validate_client_key(self, client_key, request):
         """Validates that supplied client key is a registered and valid client.
@@ -482,7 +492,7 @@ class RequestValidator(object):
         * ResourceEndpoint
         * SignatureOnlyEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_client_key")
 
     def validate_request_token(self, client_key, token, request):
         """Validates that supplied request token is registered and valid.
@@ -516,7 +526,7 @@ class RequestValidator(object):
 
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_request_token")
 
     def validate_access_token(self, client_key, token, request):
         """Validates that supplied access token is registered and valid.
@@ -550,7 +560,7 @@ class RequestValidator(object):
 
         * ResourceEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_access_token")
 
     def validate_timestamp_and_nonce(self, client_key, timestamp, nonce,
                                      request, request_token=None, access_token=None):
@@ -600,7 +610,7 @@ class RequestValidator(object):
         * ResourceEndpoint
         * SignatureOnlyEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_timestamp_and_nonce")
 
     def validate_redirect_uri(self, client_key, redirect_uri, request):
         """Validates the client supplied redirection URI.
@@ -633,7 +643,7 @@ class RequestValidator(object):
 
         * RequestTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_redirect_uri")
 
     def validate_requested_realms(self, client_key, realms, request):
         """Validates that the client may request access to the realm.
@@ -651,7 +661,7 @@ class RequestValidator(object):
 
         * RequestTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_requested_realms")
 
     def validate_realms(self, client_key, token, request, uri=None,
                         realms=None):
@@ -685,7 +695,7 @@ class RequestValidator(object):
 
         * ResourceEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_realms")
 
     def validate_verifier(self, client_key, token, verifier, request):
         """Validates a verification code.
@@ -716,7 +726,7 @@ class RequestValidator(object):
 
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("validate_verifier")
 
     def verify_request_token(self, token, request):
         """Verify that the given OAuth1 request token is valid.
@@ -734,7 +744,7 @@ class RequestValidator(object):
 
         * AuthorizationEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("verify_request_token")
 
     def verify_realms(self, token, realms, request):
         """Verify authorized realms to see if they match those given to token.
@@ -757,7 +767,7 @@ class RequestValidator(object):
 
         * AuthorizationEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("verify_realms")
 
     def save_access_token(self, token, request):
         """Save an OAuth1 access token.
@@ -780,7 +790,7 @@ class RequestValidator(object):
 
         * AccessTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("save_access_token")
 
     def save_request_token(self, token, request):
         """Save an OAuth1 request token.
@@ -800,7 +810,7 @@ class RequestValidator(object):
 
         * RequestTokenEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("save_request_token")
 
     def save_verifier(self, token, verifier, request):
         """Associate an authorization verifier with a request token.
@@ -820,4 +830,4 @@ class RequestValidator(object):
 
         * AuthorizationEndpoint
         """
-        raise NotImplementedError("Subclasses must implement this function.")
+        raise self._subclass_must_implement("save_verifier")
diff --git a/oauthlib/oauth1/rfc5849/signature.py b/oauthlib/oauth1/rfc5849/signature.py
index 8fa22ba..10d057f 100644
--- a/oauthlib/oauth1/rfc5849/signature.py
+++ b/oauthlib/oauth1/rfc5849/signature.py
@@ -26,14 +26,19 @@ from __future__ import absolute_import, unicode_literals
 import binascii
 import hashlib
 import hmac
+import logging
+
+from oauthlib.common import (bytes_type, extract_params, safe_string_equals,
+                             unicode_type, urldecode)
+
+from . import utils
+
 try:
     import urlparse
 except ImportError:
     import urllib.parse as urlparse
-from . import utils
-from oauthlib.common import urldecode, extract_params, safe_string_equals
-from oauthlib.common import bytes_type, unicode_type
 
+log = logging.getLogger(__name__)
 
 def construct_base_string(http_method, base_string_uri,
                           normalized_encoded_request_parameters):
@@ -566,7 +571,11 @@ def verify_hmac_sha1(request, client_secret=None,
     base_string = construct_base_string(request.http_method, uri, norm_params)
     signature = sign_hmac_sha1(base_string, client_secret,
                                resource_owner_secret)
-    return safe_string_equals(signature, request.signature)
+    match = safe_string_equals(signature, request.signature)
+    if not match:
+        log.debug('Verify HMAC-SHA1 failed: sig base string: %s', base_string)
+    return match
+
 
 def _prepare_key_plus(alg, keystr):
     if isinstance(keystr, bytes_type):
@@ -597,7 +606,11 @@ def verify_rsa_sha1(request, rsa_public_key):
 
     alg = _jwt_rs1_signing_algorithm()
     key = _prepare_key_plus(alg, rsa_public_key)
-    return alg.verify(message, key, sig)
+
+    verify_ok = alg.verify(message, key, sig)
+    if not verify_ok:
+        log.debug('Verify RSA-SHA1 failed: sig base string: %s', message)
+    return verify_ok
 
 
 def verify_plaintext(request, client_secret=None, resource_owner_secret=None):
@@ -608,4 +621,7 @@ def verify_plaintext(request, client_secret=None, resource_owner_secret=None):
     .. _`section 3.4`: http://tools.ietf.org/html/rfc5849#section-3.4
     """
     signature = sign_plaintext(client_secret, resource_owner_secret)
-    return safe_string_equals(signature, request.signature)
+    match = safe_string_equals(signature, request.signature)
+    if not match:
+        log.debug('Verify PLAINTEXT failed')
+    return match
diff --git a/oauthlib/oauth1/rfc5849/utils.py b/oauthlib/oauth1/rfc5849/utils.py
index eafb303..979e5f6 100644
--- a/oauthlib/oauth1/rfc5849/utils.py
+++ b/oauthlib/oauth1/rfc5849/utils.py
@@ -8,12 +8,13 @@ spec.
 """
 from __future__ import absolute_import, unicode_literals
 
+from oauthlib.common import bytes_type, quote, unicode_type, unquote
+
 try:
     import urllib2
 except ImportError:
     import urllib.request as urllib2
 
-from oauthlib.common import quote, unquote, bytes_type, unicode_type
 
 UNICODE_ASCII_CHARACTER_SET = ('abcdefghijklmnopqrstuvwxyz'
                                'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -53,7 +54,7 @@ def escape(u):
     """
     if not isinstance(u, unicode_type):
         raise ValueError('Only unicode objects are escapable. ' +
-                         'Got %s of type %s.' % (u, type(u)))
+                         'Got %r of type %s.' % (u, type(u)))
     # Letters, digits, and the characters '_.-' are already treated as safe
     # by urllib.quote(). We need to add '~' to fully support rfc5849.
     return quote(u, safe=b'~')
diff --git a/oauthlib/oauth2/__init__.py b/oauthlib/oauth2/__init__.py
index a13e484..c8d934e 100644
--- a/oauthlib/oauth2/__init__.py
+++ b/oauthlib/oauth2/__init__.py
@@ -23,7 +23,7 @@ from .rfc6749.endpoints import WebApplicationServer
 from .rfc6749.endpoints import MobileApplicationServer
 from .rfc6749.endpoints import LegacyApplicationServer
 from .rfc6749.endpoints import BackendApplicationServer
-from .rfc6749.errors import *
+from .rfc6749.errors import AccessDeniedError, AccountSelectionRequired, ConsentRequired, FatalClientError, FatalOpenIDClientError, InsecureTransportError, InteractionRequired, InvalidClientError, InvalidClientIdError, InvalidGrantError, InvalidRedirectURIError, InvalidRequestError, InvalidRequestFatalError, InvalidScopeError, LoginRequired, MismatchingRedirectURIError, MismatchingStateError, MissingClientIdError, MissingCodeError, MissingRedirectURIError, MissingResponseTypeError, Missi [...]
 from .rfc6749.grant_types import AuthorizationCodeGrant
 from .rfc6749.grant_types import ImplicitGrant
 from .rfc6749.grant_types import ResourceOwnerPasswordCredentialsGrant
diff --git a/oauthlib/oauth2/rfc6749/clients/__init__.py b/oauthlib/oauth2/rfc6749/clients/__init__.py
index 65bea50..17d0023 100644
--- a/oauthlib/oauth2/rfc6749/clients/__init__.py
+++ b/oauthlib/oauth2/rfc6749/clients/__init__.py
@@ -8,7 +8,7 @@ for consuming OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
 
-from .base import *
+from .base import Client, AUTH_HEADER, URI_QUERY, BODY
 from .web_application import WebApplicationClient
 from .mobile_application import MobileApplicationClient
 from .legacy_application import LegacyApplicationClient
diff --git a/oauthlib/oauth2/rfc6749/clients/backend_application.py b/oauthlib/oauth2/rfc6749/clients/backend_application.py
index 445bdd5..7505b0d 100644
--- a/oauthlib/oauth2/rfc6749/clients/backend_application.py
+++ b/oauthlib/oauth2/rfc6749/clients/backend_application.py
@@ -8,9 +8,8 @@ for consuming and providing OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
 
+from ..parameters import parse_token_response, prepare_token_request
 from .base import Client
-from ..parameters import prepare_token_request
-from ..parameters import parse_token_response
 
 
 class BackendApplicationClient(Client):
diff --git a/oauthlib/oauth2/rfc6749/clients/base.py b/oauthlib/oauth2/rfc6749/clients/base.py
index e804b9a..c2f8809 100644
--- a/oauthlib/oauth2/rfc6749/clients/base.py
+++ b/oauthlib/oauth2/rfc6749/clients/base.py
@@ -12,14 +12,13 @@ import time
 
 from oauthlib.common import generate_token
 from oauthlib.oauth2.rfc6749 import tokens
-from oauthlib.oauth2.rfc6749.parameters import parse_token_response
-from oauthlib.oauth2.rfc6749.parameters import prepare_token_request
-from oauthlib.oauth2.rfc6749.parameters import prepare_token_revocation_request
-from oauthlib.oauth2.rfc6749.errors import TokenExpiredError
-from oauthlib.oauth2.rfc6749.errors import InsecureTransportError
+from oauthlib.oauth2.rfc6749.errors import (InsecureTransportError,
+                                            TokenExpiredError)
+from oauthlib.oauth2.rfc6749.parameters import (parse_token_response,
+                                                prepare_token_request,
+                                                prepare_token_revocation_request)
 from oauthlib.oauth2.rfc6749.utils import is_secure_transport
 
-
 AUTH_HEADER = 'auth_header'
 URI_QUERY = 'query'
 BODY = 'body'
@@ -487,4 +486,3 @@ class Client(object):
 
         if 'mac_algorithm' in response:
             self.mac_algorithm = response.get('mac_algorithm')
-
diff --git a/oauthlib/oauth2/rfc6749/clients/legacy_application.py b/oauthlib/oauth2/rfc6749/clients/legacy_application.py
index e4e522a..57fe99e 100644
--- a/oauthlib/oauth2/rfc6749/clients/legacy_application.py
+++ b/oauthlib/oauth2/rfc6749/clients/legacy_application.py
@@ -8,9 +8,8 @@ for consuming and providing OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
 
+from ..parameters import parse_token_response, prepare_token_request
 from .base import Client
-from ..parameters import prepare_token_request
-from ..parameters import parse_token_response
 
 
 class LegacyApplicationClient(Client):
diff --git a/oauthlib/oauth2/rfc6749/clients/mobile_application.py b/oauthlib/oauth2/rfc6749/clients/mobile_application.py
index 9e3ef21..490efcd 100644
--- a/oauthlib/oauth2/rfc6749/clients/mobile_application.py
+++ b/oauthlib/oauth2/rfc6749/clients/mobile_application.py
@@ -8,9 +8,8 @@ for consuming and providing OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
 
+from ..parameters import parse_implicit_response, prepare_grant_uri
 from .base import Client
-from ..parameters import prepare_grant_uri
-from ..parameters import parse_implicit_response
 
 
 class MobileApplicationClient(Client):
diff --git a/oauthlib/oauth2/rfc6749/clients/service_application.py b/oauthlib/oauth2/rfc6749/clients/service_application.py
index 36da98b..e6c3270 100644
--- a/oauthlib/oauth2/rfc6749/clients/service_application.py
+++ b/oauthlib/oauth2/rfc6749/clients/service_application.py
@@ -12,9 +12,8 @@ import time
 
 from oauthlib.common import to_unicode
 
+from ..parameters import parse_token_response, prepare_token_request
 from .base import Client
-from ..parameters import prepare_token_request
-from ..parameters import parse_token_response
 
 
 class ServiceApplicationClient(Client):
diff --git a/oauthlib/oauth2/rfc6749/clients/web_application.py b/oauthlib/oauth2/rfc6749/clients/web_application.py
index c685d3c..c099d99 100644
--- a/oauthlib/oauth2/rfc6749/clients/web_application.py
+++ b/oauthlib/oauth2/rfc6749/clients/web_application.py
@@ -8,10 +8,10 @@ for consuming and providing OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
 
+from ..parameters import (parse_authorization_code_response,
+                          parse_token_response, prepare_grant_uri,
+                          prepare_token_request)
 from .base import Client
-from ..parameters import prepare_grant_uri, prepare_token_request
-from ..parameters import parse_authorization_code_response
-from ..parameters import parse_token_response
 
 
 class WebApplicationClient(Client):
diff --git a/oauthlib/oauth2/rfc6749/endpoints/authorization.py b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
index de100b1..b6e0734 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/authorization.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
@@ -7,6 +7,7 @@ This module is an implementation of various logic needed
 for consuming and providing OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
+
 import logging
 
 from oauthlib.common import Request
diff --git a/oauthlib/oauth2/rfc6749/endpoints/base.py b/oauthlib/oauth2/rfc6749/endpoints/base.py
index 759c6c8..cdb015f 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/base.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/base.py
@@ -11,8 +11,8 @@ from __future__ import absolute_import, unicode_literals
 import functools
 import logging
 
-from ..errors import TemporarilyUnavailableError, ServerError
-from ..errors import FatalClientError, OAuth2Error
+from ..errors import (FatalClientError, OAuth2Error, ServerError,
+                      TemporarilyUnavailableError)
 
 log = logging.getLogger(__name__)
 
diff --git a/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py b/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py
index 7463484..6428b8d 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py
@@ -8,20 +8,16 @@ for consuming and providing OAuth 2.0 RFC6749.
 """
 from __future__ import absolute_import, unicode_literals
 
-from ..grant_types import OpenIDConnectAuthCode
+from ..grant_types import (AuthCodeGrantDispatcher, AuthorizationCodeGrant,
+                           ClientCredentialsGrant, ImplicitGrant,
+                           OpenIDConnectAuthCode, OpenIDConnectImplicit,
+                           RefreshTokenGrant,
+                           ResourceOwnerPasswordCredentialsGrant)
 from ..tokens import BearerToken
-from ..grant_types import AuthorizationCodeGrant
-from ..grant_types import ImplicitGrant
-from ..grant_types import ResourceOwnerPasswordCredentialsGrant
-from ..grant_types import ClientCredentialsGrant
-from ..grant_types import RefreshTokenGrant
-from ..grant_types import OpenIDConnectImplicit
-from ..grant_types import AuthCodeGrantDispatcher
-
 from .authorization import AuthorizationEndpoint
-from .token import TokenEndpoint
 from .resource import ResourceEndpoint
 from .revocation import RevocationEndpoint
+from .token import TokenEndpoint
 
 
 class Server(AuthorizationEndpoint, TokenEndpoint, ResourceEndpoint,
@@ -79,7 +75,7 @@ class Server(AuthorizationEndpoint, TokenEndpoint, ResourceEndpoint,
                                    'password': password_grant,
                                    'client_credentials': credentials_grant,
                                    'refresh_token': refresh_grant,
-                                   'openid' : openid_connect_auth
+                                   'openid': openid_connect_auth
                                },
                                default_token_type=bearer)
         ResourceEndpoint.__init__(self, default_token='Bearer',
diff --git a/oauthlib/oauth2/rfc6749/endpoints/revocation.py b/oauthlib/oauth2/rfc6749/endpoints/revocation.py
... 1893 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-oauthlib.git



More information about the Python-modules-commits mailing list