Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ Rodney Richardson
Silvano Cerza
Stéphane Raimbault
Jun Zhou
David Smith
David Smith
Łukasz Skarżyński
4 changes: 4 additions & 0 deletions oauth2_provider/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ def get(self, request, *args, **kwargs):
kwargs["redirect_uri"] = credentials["redirect_uri"]
kwargs["response_type"] = credentials["response_type"]
kwargs["state"] = credentials["state"]
if "code_challenge" in credentials:
kwargs["code_challenge"] = credentials["code_challenge"]
if "code_challenge_method" in credentials:
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
Expand Down
10 changes: 6 additions & 4 deletions tests/test_authorization_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def test_public_pkce_S256_authorize_get(self):
"""
Request an access token using client_type: public
and PKCE enabled. Tests if the authorize get is successfull
for the S256 algorithm
for the S256 algorithm and form data are properly passed.
"""
self.client.login(username="test_user", password="123456")

Expand All @@ -1033,14 +1033,15 @@ def test_public_pkce_S256_authorize_get(self):
}

response = self.client.get(reverse("oauth2_provider:authorize"), data=query_data)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="S256"', count=1, status_code=200)
self.assertContains(response, 'value="{0}"'.format(code_challenge), count=1, status_code=200)
oauth2_settings.PKCE_REQUIRED = False

def test_public_pkce_plain_authorize_get(self):
"""
Request an access token using client_type: public
and PKCE enabled. Tests if the authorize get is successfull
for the plain algorithm
for the plain algorithm and form data are properly passed.
"""
self.client.login(username="test_user", password="123456")

Expand All @@ -1061,7 +1062,8 @@ def test_public_pkce_plain_authorize_get(self):
}

response = self.client.get(reverse("oauth2_provider:authorize"), data=query_data)
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="plain"', count=1, status_code=200)
self.assertContains(response, 'value="{0}"'.format(code_challenge), count=1, status_code=200)
oauth2_settings.PKCE_REQUIRED = False

def test_public_pkce_S256(self):
Expand Down