使用 Python 3 在 wsgi 中打开 ID
我以前从未做过身份验证工作,但希望能够通过 openID 跟踪和验证用户。我看到了几个允许使用 WSGI 进行 openID 身份验证的模块,但它们都很旧并且没有提到 python3,所以我猜它们不起作用。
我想要一些关于如何在 WSGI 和 python3 中处理/验证 openID 的建议。一个简单的实现将不胜感激。
I have never done authentication stuff before, but would like to be able to track and authenticate users via openID. I saw a couple modules that allow for openID authentication with WSGI, but all are old and none mention python3, so I'm guessing they do not work.
I'd like some suggestions as to how to handle/authenticate openID in WSGI and python3. A simple implementation would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
立即对此答案提出两个警告:
我已经非常熟悉您的框架、urllib 及其朋友,实现这一点仍然需要一些时间。这不是小事。
openid2rp 代码看起来还没有准备好。
尽管如此。最新版本的 openid2rp 可以使用 2to3 在 Python 3 中工作。您将需要修复一些小问题。
包含的示例代码不起作用,但您可以将其用作模板来编写应用程序。如果您比较注意字节与字符串,那么应该需要不到两年的时间即可获得有效的 OpenID 登录。 (:
我已经设法以这种方式将其翻译成cherrypy。虽然这不是您正在寻找的内容,但它可能是一个有用的指南:http://paste.ubuntu.com/699338/
例如,运行 2to3 后这种代码仍然存在:
你会看到这些东西编写实际的登录代码。
这是我的
__init__.py
。请注意,我尚未使用的方法仍然存在错误! 699354/" rel="nofollow">http://paste.ubuntu.com/699354/Two caveats on this answer right away:
I've you're well versed in your framework, urllib and it's friends, implementing this will still take a bit of time. It's not trivial.
The openid2rp code doesn't look all that, uhm, ready.
None the less. The latest version of openid2rp can be translated with 2to3 to work in Python 3. You will need to fix a couple of small things.
The included example code won't work, but you can use it as a template to write your application. If you're careful about bytes vs. strings, it should take less than two years to get a working OpenID login. (:
I've managed to translate it into cherrypy this way. While that's not what you're looking for, it might be a helpful guide: http://paste.ubuntu.com/699338/
As an example, this kind of code still remains after running 2to3:
You'll see these things as you write the actual login-code.
This is my
__init__.py
. Note that the methods I don't yet use still have bugs! http://paste.ubuntu.com/699354/