Skip to content

Commit f5ffb67

Browse files
committed
added auth token cookie check
fix for issue 'splunklib expects any Set-Cookie to be an auth cookie from Splunk. This is a problem when authenticating with a bearer token.'
1 parent 44415b4 commit f5ffb67

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

splunklib/binding.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,13 @@ def get_cookies(self):
499499
return self.http._cookies
500500

501501
def has_cookies(self):
502-
"""Returns true if the ``HttpLib`` member of this instance has at least
503-
one cookie stored.
502+
"""Returns true if the ``HttpLib`` member of this instance has auth token stored.
504503
505-
:return: ``True`` if there is at least one cookie, else ``False``
504+
:return: ``True`` if there is auth token present, else ``False``
506505
:rtype: ``bool``
507506
"""
508-
return len(self.get_cookies()) > 0
507+
auth_token_key = "splunkd_8089"
508+
return auth_token_key in self.get_cookies().keys()
509509

510510
# Shared per-context request headers
511511
@property

0 commit comments

Comments
 (0)