Repoze.who.plugins.vepauth
repoze.who.plugins.vepauth的Python项目详细描述
这是一个repoze.who插件,用于通过browserid进行自动身份验证:
https://browserid.org/https://wiki.mozilla.org/Identity/BrowserIDSync
该插件实现了一个实验性的协议,用于对ReSTful进行身份验证 带有验证电子邮件协议的web服务,也就是mozilla的browserid 项目。它是为像firefox sync这样的自动化工具而设计的 客户如果你想找一些东西给你的访客 站点,请尝试:
http://github.com/mozilla-services/repoze.who.plugins.browserid
当访问受保护的资源时,服务器将生成401质询 对“oauth+vep”方案的答复如下:
> GET /protected_resource HTTP/1.1 > Host: example.com < HTTP/1.1 401 Unauthorized < WWW-Authenticate: OAuth+VEP url="/request_token"
客户端应该从这个质询中提取url并发布一个vep断言 去那个地方这将创建一个新的身份验证会话并返回 OAuth客户端凭据集:
> POST /request_token HTTP/1.1 > Host: example.com > Content-Type: application/x-www-form-urlencoded > > assertion=VEP_ASSERTION_DATA < HTTP/1.1 200 OK < Content-Type: application/json < < { < "oauth_consumer_key": SESSION_TOKEN, < "oauth_consumer_secret": SESSION_SECRET < }
随后的请求应该用两条腿的方式使用这些凭据进行签名 OAuth模式:
> GET /protected_resource HTTP/1.1 > Host: example.com > Authorization: OAuth oauth_consumer_key=SESSION_TOKEN, > oauth_signature_method="HMAC-SHA1", > oauth_version="1.0", > oauth_timestamp=TIMESTAMP, > oauth_nonce=NONCE > oauth_signature=SIGNATURE < HTTP/1.1 200 OK < Content-Type: text/plain < < For your eyes only: secret data!
会话令牌是有时间戳的,并最终将过期。如果发生这种情况 您将像以前一样收到401响应,并且应该发布一个新断言 以获得新的证书。
扩展令牌管理
repoze.who.plugins.vepauth是可扩展的。如果你想提供一个不同的 管理令牌的机制,可以通过提供不同的令牌来实现 带有token_manager选项的插件的管理器实例。
TokenManager类有两个方法不需要实现(它是 抽象类:生成令牌和解析令牌。实现细节如下 留给孩子们上课。
respose.who.plugins.vepauth附带一个签名的TokenManager 用纯python实现一个简单的令牌管理类它有很多 可以重写以自定义其行为的方法。
0.3.0-2012年2月14日
Replaced Two-Legged OAuth with MAC Access Auth, implemented according to the latest draft standard:
0.2.0-2012年2月14日
- Added basic pattern-matching for the token_url, e.g. “/{app}/token”.
- Made TokenManager.make_token and TokenManager.parse_token accept the incoming request as first argument, mostly so they can get at the results of pattern-matching.
- Let TokenManager.make_token return a dict of extra info to be included in the response.
0.1.0-2012年2月7日
- Initial release.