diff options
author | Jonathan Huot <jonathan.huot@thomsonreuters.com> | 2018-12-12 18:08:09 +0100 |
---|---|---|
committer | Jonathan Huot <jonathan.huot@thomsonreuters.com> | 2018-12-12 18:08:09 +0100 |
commit | a9ec83a40477e6b5b460b6f203607199f5f16779 (patch) | |
tree | e44a3498283d987a69eaf5f64de2a993559ae326 | |
parent | 5f629b5dce3fc6aafb5908480ed241c6f5b4cfbb (diff) | |
download | oauthlib-264-status401.tar.gz |
Add double-quotes to the key/values in WWW-Authenticate264-status401
-rw-r--r-- | oauthlib/oauth2/rfc6749/errors.py | 6 | ||||
-rw-r--r-- | tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py | 4 | ||||
-rw-r--r-- | tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/oauthlib/oauth2/rfc6749/errors.py b/oauthlib/oauth2/rfc6749/errors.py index e5543b5..ec2b0d1 100644 --- a/oauthlib/oauth2/rfc6749/errors.py +++ b/oauthlib/oauth2/rfc6749/errors.py @@ -108,12 +108,12 @@ class OAuth2Error(Exception): """ authvalues = [ "Bearer", - "error={}".format(self.error) + 'error="{}"'.format(self.error) ] if self.description: - authvalues.append("error_description={}".format(self.description)) + authvalues.append('error_description="{}"'.format(self.description)) if self.uri: - authvalues.append("error_uri={}".format(self.uri)) + authvalues.append('error_uri="{}"'.format(self.uri)) return {"WWW-Authenticate": ", ".join(authvalues)} return {} diff --git a/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py b/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py index d252a73..e41b83f 100644 --- a/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py +++ b/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py @@ -86,7 +86,7 @@ class IntrospectEndpointTest(TestCase): ('token_type_hint', 'access_token')]) h, b, s = self.endpoint.create_introspect_response(self.uri, headers=self.headers, body=body) - self.assertEqual(h, {"WWW-Authenticate": "Bearer, error=invalid_client"}) + self.assertEqual(h, {"WWW-Authenticate": 'Bearer, error="invalid_client"'}) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) @@ -109,7 +109,7 @@ class IntrospectEndpointTest(TestCase): ('token_type_hint', 'access_token')]) h, b, s = self.endpoint.create_introspect_response(self.uri, headers=self.headers, body=body) - self.assertEqual(h, {"WWW-Authenticate": "Bearer, error=invalid_client"}) + self.assertEqual(h, {"WWW-Authenticate": 'Bearer, error="invalid_client"'}) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) diff --git a/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py b/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py index 8a434e2..a6a5cb2 100644 --- a/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py +++ b/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py @@ -49,7 +49,7 @@ class RevocationEndpointTest(TestCase): ('token_type_hint', 'access_token')]) h, b, s = self.endpoint.create_revocation_response(self.uri, headers=self.headers, body=body) - self.assertEqual(h, {"WWW-Authenticate": "Bearer, error=invalid_client"}) + self.assertEqual(h, {"WWW-Authenticate": 'Bearer, error="invalid_client"'}) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) @@ -72,7 +72,7 @@ class RevocationEndpointTest(TestCase): ('token_type_hint', 'access_token')]) h, b, s = self.endpoint.create_revocation_response(self.uri, headers=self.headers, body=body) - self.assertEqual(h, {"WWW-Authenticate": "Bearer, error=invalid_client"}) + self.assertEqual(h, {"WWW-Authenticate": 'Bearer, error="invalid_client"'}) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) |