如何使用 Django 活塞身份验证会话?
问题是我想将身份验证存储在一个 cookie 中,我可以将其呈现给 django 活塞,而不是要求每次都输入用户/密码(无需硬编码或将用户/密码组合存储在磁盘上的某个位置)。我希望能够像没有活塞 API 的人那样使用 cookie 来完成此任务。我错过了什么吗?
Django Piston 似乎根本不关心会话cookie?
或者有人可以建议一个好的选择吗?也许我不应该使用活塞?
The problem is that I want to store authentication in a cookie that I can present to django piston rather than requiring user/password to be typed in each time (without hardcoding or storing the user/pass combo somewhere on disk). I was hoping to accomplish this with cookies like someone would without the piston API. Am I missing something?
Django Piston doesn't seem to care about session cookies at all?
Or can someone suggest a good alternative? Maybe I shouldn't use Piston?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://yml-blog.blogspot.com/2009 /10/django-piston-authentication-against.html
http://yml-blog.blogspot.com/2009/10/django-piston-authentication-against.html
如果您尝试让用户在身份验证后保持登录状态,Django 的内置会话会为您做到这一点。您可以通过更改 来更改会话持续时间SESSION_COOKIE_AGE 设置。这也将改变会话在数据库中保留的时间(如果您使用的是数据库后端)。
If you are trying to keep a user logged in after they authenticate, Django's built in Sessions do that for you. You can change how long the session lasts by changing the SESSION_COOKIE_AGE setting. This will also change how long the sessions persist in your database (if you are using a database backend).