VaclavDedik VaclavDedik - 1 year ago 395
Python Question

JIRA REST API and kerberos authentication

I am struggling with Jira REST API authentication via kerberos. Basic authentication works as expected.

If I access the login page with the web browser (after I did kinit) and then use the generated JSESSIONID in my python script, I can use REST without getting 401. But I have no ide how to do that with my python script, I tried to use requests_kerberos, but when I request the login page, it simply returns the basic login form instead of automatic login.

Do you know how to use JIRA REST API with kerberos authentication?

Thanks for you answers.

Answer Source

After a day of struggle I finally figured it out.

First you have to send an HTTP GET request to ${jira-url}/step-auth-gss:

r = requests.get("", auth=requests_kerberos.HTTPKerberosAuth())

Then you get the JSESSIONID from the cookie header and you can REST away:

rd = requests.get(url, headers={"Cookie": "JSESSIONID=%s" % r.cookies['JSESSIONID']})
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download