All Apps and Add-ons

Custom Authentication Handler for session id

mdorobek
Path Finder

Hello there,

I try to use a custom authentication handler to set a header with a session-ID I get from another REST request.
Heres my class in the authhandlers.py

class AuthHeader(AuthBase):

    def __init__(self,**args):
        self.username = args['username']
        self.password = args['password']
        self.ip = args['ip']

    def __call__(self, r):

        url = "https://" + self.ip + "/api/endeavour/session"
        session_json = requests.post(url, verify=False, auth=HTTPBasicAuth(self.username, self.password))
        session_json.json()['sessionid']
        headers = {'content-type':application/json, 'accept':application/json, 'x-endeavour-sessionid':session_json.json()['sessionid']}
        r.headers = headers
        return r

And heres my config in the GUI:
alt text

Somehow this doesnt work and I dont get any events. Can somone help me and find the mistake?

Kind regards,
mdorobek

0 Karma
1 Solution

mdorobek
Path Finder

Turns out it was a missing import. I had to import requests.

View solution in original post

0 Karma

mdorobek
Path Finder

Turns out it was a missing import. I had to import requests.

0 Karma

Damien_Dallimor
Ultra Champion

You'll have better luck in the BaboonBones Community Slack (you would have received a complimentary invite with your key), or you can get free access at http://www.baboonbones.com/#support

0 Karma

mdorobek
Path Finder

I just found a solution.

Nevertheless thank you, I received the key by a colleague and didn't know there is a community. I will try it in future if I have another question.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...