Skip to content

Commit

Permalink
Send Authorization header irrespective of previous authentication sta…
Browse files Browse the repository at this point in the history
…tus (requests#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.
  • Loading branch information
chamakuri-vineel committed Jan 13, 2024
1 parent 3e0371a commit 318fd99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion requests_kerberos/kerberos_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 318fd99

Please sign in to comment.