【问题标题】:How to use Kerberos libraries in Python?如何在 Python 中使用 Kerberos 库?
【发布时间】:2018-04-28 22:57:02
【问题描述】:

我正在尝试使用一些 Python 库来自动登录到 Kerberos 帐户。比如我找到requests_kerberos,我的代码是:

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

然而,甚至在我有机会输入我的用户名和密码之前,第三行就出现了requests_kerberos.exceptions.MutualAuthenticationError: Unable to authenticate <Response [200]>

有什么问题吗? UBC CWL 是否支持通过 Kerberos 登录?

【问题讨论】:

    标签: python python-requests kerberos


    【解决方案1】:

    您可以禁用相互身份验证,如下所示: https://github.com/requests/requests-kerberos

    这可以工作:

    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))
    

    【讨论】:

      【解决方案2】:

      我不知道我的理解是不是很糟糕,但最后你想连接到 UBC 服务? 因为我找到了一些 Github 项目来做到这一点:

      【讨论】:

        猜你喜欢
        • 2019-11-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-29
        • 1970-01-01
        • 2010-09-22
        • 2021-08-26
        • 2014-08-26
        相关资源
        最近更新 更多