summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Huot <JonathanHuot@users.noreply.github.com>2019-05-07 20:58:48 +0200
committerGitHub <noreply@github.com>2019-05-07 20:58:48 +0200
commit18425dd9634c14c8eba7377f53699db5f3c3e97a (patch)
treee3b07839c16b273dc47e8a6663aac1ba11b81c8a
parentb6b4d9fa68afa7a588015722f4d3d359b3a86b1f (diff)
parent58995124a96646930e5d4f12b8221a11ea210288 (diff)
downloadoauthlib-18425dd9634c14c8eba7377f53699db5f3c3e97a.tar.gz
Merge pull request #671 from oauthlib/670-pkce-requestinfo
Fix 670. AuthCode API must return the new PKCE attribute
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/authorization_code.py3
-rw-r--r--tests/oauth2/rfc6749/grant_types/test_authorization_code.py6
2 files changed, 7 insertions, 2 deletions
diff --git a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
index 5f03d9c..9b84c4c 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
@@ -405,12 +405,15 @@ class AuthorizationCodeGrant(GrantTypeBase):
raise errors.MissingCodeChallengeError(request=request)
if request.code_challenge is not None:
+ request_info["code_challenge"] = request.code_challenge
+
# OPTIONAL, defaults to "plain" if not present in the request.
if request.code_challenge_method is None:
request.code_challenge_method = "plain"
if request.code_challenge_method not in self._code_challenge_methods:
raise errors.UnsupportedCodeChallengeMethodError(request=request)
+ request_info["code_challenge_method"] = request.code_challenge_method
# OPTIONAL. The scope of the access request as described by Section 3.3
# https://tools.ietf.org/html/rfc6749#section-3.3
diff --git a/tests/oauth2/rfc6749/grant_types/test_authorization_code.py b/tests/oauth2/rfc6749/grant_types/test_authorization_code.py
index 00e2b6d..2c9db3c 100644
--- a/tests/oauth2/rfc6749/grant_types/test_authorization_code.py
+++ b/tests/oauth2/rfc6749/grant_types/test_authorization_code.py
@@ -215,8 +215,10 @@ class AuthorizationCodeGrantTest(TestCase):
self.mock_validator.is_pkce_required.return_value = required
self.request.code_challenge = "present"
_, ri = self.auth.validate_authorization_request(self.request)
- self.assertIsNotNone(ri["request"].code_challenge_method)
- self.assertEqual(ri["request"].code_challenge_method, "plain")
+ self.assertIn("code_challenge", ri)
+ self.assertIn("code_challenge_method", ri)
+ self.assertEqual(ri["code_challenge"], "present")
+ self.assertEqual(ri["code_challenge_method"], "plain")
def test_pkce_wrong_method(self):
for required in [True, False]: