From 8273e9c1648e353e35b8d5062a42411e3a591ef4 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Wed, 8 Apr 2020 18:31:21 +0800 Subject: [PATCH 1/4] pkce in oauthlib 3.1.0 --- docs/requirements.txt | 2 +- oauth2_provider/views/base.py | 10 ---------- setup.cfg | 2 +- tox.ini | 4 ++-- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 63d82768f..c1f72699b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ Django>=3.0,<3.1 -oauthlib>=3.0.1 +oauthlib>=3.1.0 m2r>=0.2.1 . diff --git a/oauth2_provider/views/base.py b/oauth2_provider/views/base.py index 8a3a59c25..1a3a26f46 100644 --- a/oauth2_provider/views/base.py +++ b/oauth2_provider/views/base.py @@ -139,16 +139,6 @@ def form_valid(self, form): def get(self, request, *args, **kwargs): try: scopes, credentials = self.validate_authorization_request(request) - # TODO: Remove the two following lines after oauthlib updates its implementation - # https://github.com/jazzband/django-oauth-toolkit/pull/707#issuecomment-485011945 - credentials["code_challenge"] = credentials.get( - "code_challenge", - request.GET.get("code_challenge", None) - ) - credentials["code_challenge_method"] = credentials.get( - "code_challenge_method", - request.GET.get("code_challenge_method", None) - ) except OAuthToolkitError as error: # Application is not available at this time. return self.error_response(error, application=None) diff --git a/setup.cfg b/setup.cfg index bd15cadca..3c4e0badc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,7 +33,7 @@ zip_safe = False install_requires = django >= 2.1 requests >= 2.13.0 - oauthlib >= 3.0.1 + oauthlib >= 3.1.0 [options.packages.find] exclude = tests diff --git a/tox.ini b/tox.ini index 210106f57..a2a5549db 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ deps = django30: Django>=3.0,<3.1 djangomaster: https://github.com/django/django/archive/master.tar.gz djangorestframework - oauthlib>=3.0.1 + oauthlib>=3.1.0 coverage pytest pytest-cov @@ -40,7 +40,7 @@ changedir = docs whitelist_externals = make commands = make html deps = sphinx - oauthlib>=3.0.1 + oauthlib>=3.1.0 m2r>=0.2.1 [testenv:py37-flake8] From 3d87616147d973d2d1686c0d76e75fb668f5dfed Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Thu, 9 Apr 2020 13:44:34 +0800 Subject: [PATCH 2/4] oauthlib 3.1.0 --- README.rst | 2 +- docs/index.rst | 2 +- oauth2_provider/views/base.py | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index c5473646f..1a5adcd06 100644 --- a/README.rst +++ b/README.rst @@ -44,7 +44,7 @@ Requirements * Python 3.5+ * Django 2.1+ -* oauthlib 3.0+ +* oauthlib 3.1+ Installation ------------ diff --git a/docs/index.rst b/docs/index.rst index 8716eb90b..5889fff28 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,7 +23,7 @@ Requirements * Python 3.5+ * Django 2.1+ -* oauthlib 3.0+ +* oauthlib 3.1+ Index ===== diff --git a/oauth2_provider/views/base.py b/oauth2_provider/views/base.py index 1a3a26f46..b9b6ed7f9 100644 --- a/oauth2_provider/views/base.py +++ b/oauth2_provider/views/base.py @@ -156,8 +156,6 @@ def get(self, request, *args, **kwargs): kwargs["redirect_uri"] = credentials["redirect_uri"] kwargs["response_type"] = credentials["response_type"] kwargs["state"] = credentials["state"] - kwargs["code_challenge"] = credentials["code_challenge"] - kwargs["code_challenge_method"] = credentials["code_challenge_method"] self.oauth2_data = kwargs # following two loc are here only because of https://code.djangoproject.com/ticket/17795 From 9ee113628ac9056e7d6370e3df247c47e71bc875 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Thu, 9 Apr 2020 14:10:36 +0800 Subject: [PATCH 3/4] fix docs --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a2a5549db..950a05a44 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,7 @@ basepython = python changedir = docs whitelist_externals = make commands = make html -deps = sphinx +deps = sphinx<3.0.0 oauthlib>=3.1.0 m2r>=0.2.1 From a974cd1b64f30b4608c90f7e6ab12a1cb743ec3a Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Thu, 9 Apr 2020 14:13:08 +0800 Subject: [PATCH 4/4] sphinx<3 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 950a05a44..c984f8b99 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,7 @@ basepython = python changedir = docs whitelist_externals = make commands = make html -deps = sphinx<3.0.0 +deps = sphinx<3 oauthlib>=3.1.0 m2r>=0.2.1