From 318fd99c5057a03c42d9b25cd440882696ff3b35 Mon Sep 17 00:00:00 2001 From: chamakuri-vineel Date: Sat, 2 Sep 2023 00:43:48 +0530 Subject: [PATCH] Send Authorization header irrespective of previous authentication status (#178) - Currently 'force_preemptive' flag sends the 'Authorization' header only for the first call and not for subsequent calls. This is because 'Authorization' header is preemptively sent only if the request is not authenticated. The status of authentication is stored as 'auth_done' instance variable. Since all the HTTP calls use the same instance of HTTPKerberosAuth class the 'auth_done' instance variable is set to True after first successful authentication and thus 'Authorization' header is not set preemptively after that. - The fix is to send the Authorization header irrespective of the authentication status of previous call. --- requests_kerberos/kerberos_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests_kerberos/kerberos_.py b/requests_kerberos/kerberos_.py index 18de33d..c50b9f5 100644 --- a/requests_kerberos/kerberos_.py +++ b/requests_kerberos/kerberos_.py @@ -427,7 +427,7 @@ def deregister(self, response): response.request.deregister_hook('response', self.handle_response) def __call__(self, request): - if self.force_preemptive and not self.auth_done: + if self.force_preemptive: # add Authorization header before we receive a 401 # by the 401 handler host = urlparse(request.url).hostname