Skip to content

Commit 9a05cb6

Browse files
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.
1 parent 3e0371a commit 9a05cb6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

requests_kerberos/kerberos_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def deregister(self, response):
427427
response.request.deregister_hook('response', self.handle_response)
428428

429429
def __call__(self, request):
430-
if self.force_preemptive and not self.auth_done:
430+
if self.force_preemptive:
431431
# add Authorization header before we receive a 401
432432
# by the 401 handler
433433
host = urlparse(request.url).hostname

0 commit comments

Comments
 (0)