Repoze.who.plugins.digeseth
repoze.who.plugins.digestauth的Python项目详细描述
这是repoze.who插件实现http摘要访问身份验证 根据RFC-2617:
http://tools.ietf.org/html/rfc2617
它为协议提供了良好的支持,因为它通常用于 野生:
- both qop=”auth” and qop=”auth-int” modes
- compatability mode for legacy clients
- client nonce-count checking
- next-nonce generation via the Authentication-Info header
http客户端很少支持该协议的以下特性 因此尚未实施:
- MD5-sess, or any hash algorithm other than MD5
- mutual authentication via the Authentication-Info header
配置
摘要身份验证插件的配置可以从标准 repoze.who配置文件如下:
[plugin:digestauth] use = repoze.who.plugins.digestauth:make_plugin realm = MyRealm get_pwdhash = mymodule:get_pwdhash
以下配置选项可用:
- realm: the realm string; included verbatim in the challenge header
- domain: the domain string; included verbatim in the challenge header
- qop: the desired quality of protection (“auth” or “auth-int”)
- get_password: dotted name of a callback to get the user’s password
- get_pwdhash: dotted name of a callback to get the user’s password hash
- nonce_manager: dotted name of a class to use for nonce management
身份验证
要通过摘要身份验证对用户进行身份验证,此插件需要访问 它们的原始密码或“密码散列”,这是它们的MD5摘要 用户名、密码和身份验证领域:
def calculate_pwdhash(username, password, realm): return md5("%s:%s:%s" % (username, realm, password)).hexdigest()
必须提供回调函数“get_password”或“get_pwdhash”以 DigestAuthPlugin。
临时管理
摘要访问认证的安全性在很大程度上取决于 密码nonce的产生与管理。为了防止重播 攻击服务器必须拒绝具有重复nonce的请求。
nonce管理的细节被提取到一个单独的接口中, 由repoze.who.plugins.digestauth.nonmanager定义:nonmanager类。 默认实现使用hmac签名令牌和 最近看到的Nonce很重要。如果你有更特殊的需要 实现自己的非管理器子类
0.1.1-2012年1月30日
- 将许可证更新为MPL 2.0。