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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...