使用 Python 进行 SSO 的 SPNEGO(kerberos 令牌生成/验证) [英] SPNEGO (kerberos token generation/validation) for SSO using Python

查看:37
本文介绍了使用 Python 进行 SSO 的 SPNEGO(kerberos 令牌生成/验证)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一个简单的单点登录场景,其中一些参与的服务器将是 Windows (IIS) 设备.看起来 SPNEGO 是一个合理的路径.

I'm attempting to implement a simple Single Sign On scenario where some of the participating servers will be windows (IIS) boxes. It looks like SPNEGO is a reasonable path for this.

场景如下:

  • 用户使用他的用户名和密码登录我的 SSO 服务.我使用某种机制验证了他的身份.
  • 稍后用户想要访问应用 A.
    • 用户对 App A 的请求被 SSO 服务拦截.SSO 服务使用 SPNEGO 将用户登录到 App A:
      • SSO 服务访问 App A 网页,获得WWW-Authenticate: Negotiate"响应
      • SSO 服务代表用户生成Authorization: Negotiate xxx"响应,响应 App A.用户现在登录到 App A.

      这听起来对吗?

      我需要两件事(至少我现在能想到的):

      I need two things (at least that I can think of now):

      • 代表用户生成授权:协商xxx"令牌的能力,最好使用Python
      • 能够在 Python 中验证授权:协商 xxx"标头(用于项目的后期部分)

      推荐答案

      这正是 Apple 对其 Calendar Server 所做的.他们有一个 python gssapi 库用于流程的 kerberos 部分,以实现 SPNEGO.

      This is exactly what Apple does with its Calendar Server. They have a python gssapi library for the kerberos part of the process, in order to implement SPNEGO.

      在 CalendarServer/twistedcaldav/authkerb.py 中查找服务器身份验证部分.kerberos 模块(它是一个 c 模块)没有任何有用的文档字符串,但 PyKerberos/pysrc/kerberos.py 具有所有函数定义.

      Look in CalendarServer/twistedcaldav/authkerb.py for the server auth portion. The kerberos module (which is a c module), doesn't have any useful docstrings, but PyKerberos/pysrc/kerberos.py has all the function definitions.

      这里是 svn 中继的网址:
      http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk
      http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk

      Here's the urls for the svn trunks:
      http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk
      http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk

      这篇关于使用 Python 进行 SSO 的 SPNEGO(kerberos 令牌生成/验证)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆