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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...