From 09560e024c54e7e02616a628a4bb80f15127fc79 Mon Sep 17 00:00:00 2001 From: kamenev Date: Sat, 13 Nov 2021 23:08:49 +0300 Subject: [PATCH] rm comma after Bearer in WWW-Authenticate header --- oauthlib/oauth2/rfc6749/errors.py | 7 ++----- tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py | 4 ++-- tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/oauthlib/oauth2/rfc6749/errors.py b/oauthlib/oauth2/rfc6749/errors.py index b01e247b9..da24feab7 100644 --- a/oauthlib/oauth2/rfc6749/errors.py +++ b/oauthlib/oauth2/rfc6749/errors.py @@ -103,15 +103,12 @@ def headers(self): value "Bearer". This scheme MUST be followed by one or more auth-param values. """ - authvalues = [ - "Bearer", - 'error="{}"'.format(self.error) - ] + authvalues = ['error="{}"'.format(self.error)] if self.description: authvalues.append('error_description="{}"'.format(self.description)) if self.uri: authvalues.append('error_uri="{}"'.format(self.uri)) - return {"WWW-Authenticate": ", ".join(authvalues)} + return {"WWW-Authenticate": "Bearer " + ", ".join(authvalues)} return {} diff --git a/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py b/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py index 04df6a2a1..6d3d119a3 100644 --- a/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py +++ b/tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py @@ -87,7 +87,7 @@ def test_introspect_token_client_authentication_failed(self): 'Content-Type': 'application/json', 'Cache-Control': 'no-store', 'Pragma': 'no-cache', - "WWW-Authenticate": 'Bearer, error="invalid_client"' + "WWW-Authenticate": 'Bearer error="invalid_client"' }) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) @@ -115,7 +115,7 @@ def test_introspect_token_public_client_authentication_failed(self): 'Content-Type': 'application/json', 'Cache-Control': 'no-store', 'Pragma': 'no-cache', - "WWW-Authenticate": 'Bearer, error="invalid_client"' + "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 a4182eb83..338dbd91f 100644 --- a/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py +++ b/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py @@ -55,7 +55,7 @@ def test_revoke_token_client_authentication_failed(self): 'Content-Type': 'application/json', 'Cache-Control': 'no-store', 'Pragma': 'no-cache', - "WWW-Authenticate": 'Bearer, error="invalid_client"' + "WWW-Authenticate": 'Bearer error="invalid_client"' }) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) @@ -83,7 +83,7 @@ def test_revoke_token_public_client_authentication_failed(self): 'Content-Type': 'application/json', 'Cache-Control': 'no-store', 'Pragma': 'no-cache', - "WWW-Authenticate": 'Bearer, error="invalid_client"' + "WWW-Authenticate": 'Bearer error="invalid_client"' }) self.assertEqual(loads(b)['error'], 'invalid_client') self.assertEqual(s, 401) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy