diff options
author | Seth Davis <seth@curiasolutions.com> | 2018-06-30 18:09:26 -0400 |
---|---|---|
committer | Pieter Ennes <pieter@ennes.nl> | 2018-06-30 23:09:26 +0100 |
commit | 3eaf962311dfbc566dbfa66a988e0331b91184be (patch) | |
tree | 3bf200230f1cba4dcd4170762f7b0535b1f2f138 | |
parent | 481a4ec2e29530541ff8985cce938ece7a661562 (diff) | |
download | oauthlib-3eaf962311dfbc566dbfa66a988e0331b91184be.tar.gz |
Remove handling of nonstandard parameter "expires" (#506)
-rw-r--r-- | oauthlib/oauth2/rfc6749/parameters.py | 7 | ||||
-rw-r--r-- | tests/oauth2/rfc6749/test_parameters.py | 11 |
2 files changed, 2 insertions, 16 deletions
diff --git a/oauthlib/oauth2/rfc6749/parameters.py b/oauthlib/oauth2/rfc6749/parameters.py index 0107933..9ea8c44 100644 --- a/oauthlib/oauth2/rfc6749/parameters.py +++ b/oauthlib/oauth2/rfc6749/parameters.py @@ -362,16 +362,13 @@ def parse_token_response(body, scope=None): # https://github.com/oauthlib/oauthlib/issues/267 params = dict(urlparse.parse_qsl(body)) - for key in ('expires_in', 'expires'): - if key in params: # cast a couple things to int + for key in ('expires_in',): + if key in params: # cast things to int params[key] = int(params[key]) if 'scope' in params: params['scope'] = scope_to_list(params['scope']) - if 'expires' in params: - params['expires_in'] = params.pop('expires') - if 'expires_in' in params: params['expires_at'] = time.time() + int(params['expires_in']) diff --git a/tests/oauth2/rfc6749/test_parameters.py b/tests/oauth2/rfc6749/test_parameters.py index 2a9cbe8..6ba98c0 100644 --- a/tests/oauth2/rfc6749/test_parameters.py +++ b/tests/oauth2/rfc6749/test_parameters.py @@ -115,13 +115,6 @@ class ParameterTests(TestCase): ' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",' ' "example_parameter": "example_value" }') - json_expires = ('{ "access_token": "2YotnFZFEjr1zCsicMWpAA",' - ' "token_type": "example",' - ' "expires": 3600,' - ' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",' - ' "example_parameter": "example_value",' - ' "scope":"abc def"}') - json_dict = { 'access_token': '2YotnFZFEjr1zCsicMWpAA', 'token_type': 'example', @@ -264,7 +257,3 @@ class ParameterTests(TestCase): finally: signals.scope_changed.disconnect(record_scope_change) del os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE'] - - def test_token_response_with_expires(self): - """Verify fallback for alternate spelling of expires_in. """ - self.assertEqual(parse_token_response(self.json_expires), self.json_dict) |