@@ -62,24 +62,24 @@ async def authenticate_request(self, request: Request) -> OAuthClientInformation
6262 """
6363 client_credentials = await self ._get_credentials (request )
6464 client = await self .provider .get_client (client_credentials .client_id )
65+
6566 if not client :
6667 raise AuthenticationError ("Invalid client_id" ) # pragma: no cover
6768
68- match client .token_endpoint_auth_method :
69- case "client_secret_basic" :
70- if client_credentials .auth_method != "client_secret_basic" :
71- raise AuthenticationError (
72- f"Expected client_secret_basic authentication method, but got { client_credentials .auth_method } "
73- )
74- case "client_secret_post" :
75- if client_credentials .auth_method != "client_secret_post" :
76- raise AuthenticationError (
77- f"Expected client_secret_post authentication method, but got { client_credentials .auth_method } "
78- )
79- case "none" :
80- pass
81- case _: # pragma: no cover
82- raise AuthenticationError (f"Unsupported auth method: { client .token_endpoint_auth_method } " )
69+ if client .token_endpoint_auth_method == "client_secret_basic" :
70+ if client_credentials .auth_method != "client_secret_basic" :
71+ raise AuthenticationError (
72+ f"Expected client_secret_basic authentication method, but got { client_credentials .auth_method } "
73+ )
74+ elif client .token_endpoint_auth_method == "client_secret_post" :
75+ if client_credentials .auth_method != "client_secret_post" :
76+ raise AuthenticationError (
77+ f"Expected client_secret_post authentication method, but got { client_credentials .auth_method } "
78+ )
79+ elif client .token_endpoint_auth_method == "none" :
80+ pass
81+ else : # pragma: no cover
82+ raise AuthenticationError (f"Unsupported auth method: { client .token_endpoint_auth_method } " )
8383
8484 # If client from the store expects a secret, validate that the request provides
8585 # that secret
0 commit comments