Eric Stdlib
Eric Stdlib

Reputation: 1562

How to use Kerberos libraries in Python?

I am trying to use some Python library to automatically login to a Kerberos account. For example, I found requests_kerberos, and my code is:

import requests
from requests_kerberos import HTTPKerberosAuth, REQUIRED
r = requests.get("https://cas.id.ubc.ca/ubc-cas/login", auth=HTTPKerberosAuth())

However, even before I have a chance to input my username and password, the third line raises requests_kerberos.exceptions.MutualAuthenticationError: Unable to authenticate <Response [200]>

Is there something wrong? Does UBC CWL support logging in by Kerberos?

Upvotes: 5

Views: 5792

Answers (2)

rvd
rvd

Reputation: 404

You can disable the mutual authentication as indicated here: https://github.com/requests/requests-kerberos

This could work:

import requests
from requests_kerberos import HTTPKerberosAuth, REQUIRED, OPTIONAL, DISABLED
r = requests.get("https://cas.id.ubc.ca/ubc-cas/login", auth=HTTPKerberosAuth(mutual_authentication=OPTIONAL))

Upvotes: 3

Martin
Martin

Reputation: 171

I don't know if my understanding is goob but finally you want to connect to UBC services ? Because I found some Github project to do that:

Upvotes: 0

Related Questions