Skip to content

Commit

Permalink
Drop Django 1 / Python 2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Jul 15, 2020
1 parent 307ac15 commit 2243ab0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 2.0.0 [2020-07-15]

* 2020-07-15: afabiani Drop Django 1 / Python 2 support

### 1.1.5 [2020-03-31]

* 2020-01-31: vikipha <a href="http://github.com/GeoNode/geonode-oauth-toolkit/commit/a17a15ab7edfde73058502c1e86076409d72ab1b" target="blank"> Fixed bearer verification</a>
Expand Down
21 changes: 15 additions & 6 deletions oauth2_provider/oauth2_backends.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import json

try:
from urllib.parse import urlparse, urlunparse
except ImportError:
from urlparse import urlparse, urlunparse
from urllib.parse import urlparse, urlunparse, urlsplit, parse_qsl
from urllib.parse import urlencode as urllib_urlencode, SplitResult

from oauthlib import oauth2
from oauthlib.common import quote, urlencode, urlencoded
Expand Down Expand Up @@ -31,8 +29,19 @@ def _get_escaped_full_path(self, request):
unsafe = set(c for c in parsed[4]).difference(urlencoded)
for c in unsafe:
parsed[4] = parsed[4].replace(c, quote(c, safe=b""))

return urlunparse(parsed)
uri = urlsplit(urlunparse(parsed))
query = uri.query
params = parse_qsl(query)
encoded_params = urllib_urlencode(params, doseq=False)

parsed_url = SplitResult(
uri.scheme,
uri.netloc,
uri.path,
encoded_params,
uri.fragment)

return parsed_url.geturl()

def _get_extra_credentials(self, request):
"""
Expand Down
2 changes: 1 addition & 1 deletion oauth2_provider/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def get(self, request, *args, **kwargs):
application = get_application_model().objects.get(client_id=credentials["client_id"])

uri_query = urlparse(self.request.get_raw_uri()).query
uri_query_params = dict(parse_qsl(uri_query, keep_blank_values=True, strict_parsing=True))
uri_query_params = dict(parse_qsl(uri_query, keep_blank_values=True, strict_parsing=False))

kwargs["application"] = application
kwargs["client_id"] = credentials["client_id"]
Expand Down
12 changes: 4 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = geonode-oauth-toolkit
version = 1.1.5
version = 2.0.0
description = OAuth2 Provider for Django/GeoNode
author = Federico Frenguelli, Massimiliano Pippi, Alessio Fabiani
author_email = [email protected]
Expand All @@ -10,25 +10,21 @@ classifiers =
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 1.11
Framework :: Django :: 2.0
Framework :: Django :: 2.2
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Internet :: WWW/HTTP

[options]
packages = find:
include_package_data = True
zip_safe = False
install_requires =
django >= 1.11
django >= 2.2.0
requests >= 2.13.0
oauthlib >= 3.0.1
jwcrypto >= 0.4.2
Expand Down

0 comments on commit 2243ab0

Please sign in to comment.