@@ -823,6 +823,8 @@ def authenticated_patron(self, _db, header):
823823 # Set provider_name and provider_token so it can be referenced
824824 # in the basic auth provider check.
825825 provider_name , provider_token = None , None
826+ if isinstance (header , auth .Authorization ):
827+ header = header .parameters or header .to_header ()
826828
827829 if isinstance (header , (bytes , str )):
828830 try :
@@ -834,7 +836,7 @@ def authenticated_patron(self, _db, header):
834836
835837 if (self .basic_auth_provider
836838 and (
837- (isinstance (header , ( dict , auth . Authorization ) ) and 'username' in header )
839+ (isinstance (header , dict ) and 'username' in header )
838840 or provider_name == BasicAuthenticationProvider .BEARER_TOKEN_PROVIDER_NAME
839841 )
840842 ):
@@ -2108,7 +2110,9 @@ def get_credential_from_header(self, header):
21082110
21092111 :param header: A dictionary with keys `username` and `password`.
21102112 """
2111- if not isinstance (header , (dict , auth .Authorization )):
2113+ if isinstance (header , auth .Authorization ):
2114+ header = header .parameters
2115+ elif not isinstance (header , dict ):
21122116 return None
21132117 return header .get ('password' , None )
21142118
0 commit comments