我正在寻找一个最新的方法,让一个用户登录与著名的‘记住我’复选框。
到目前为止,我还没有把其他文章和教程结合起来:
- The Cookie is destroyed.
- A new Cookie is issued with a different **Identifier** and **Token**.
- The Database is **updated** with the new **Identifier** and **Token** values against the **user id**.
我错过了什么吗?
发布于 2014-12-22 16:30:07
您已经关闭了机制,以便根据用户登录状态将cookie存储到db。我仍然会做一个检查表,以确保它是安全的:
限制存储在cookie.中的敏感信息的数量。
** this is ok, you're only storing Identifier and Token informationLimit the subdomains and paths to prevent interception by another application.
强制使用SSL,这样cookie就不会以明文形式发送。
** if you don't already have ssl, which is a good idea to have, you can enable ssl to send that information encrypted (you have to do that in your web server config). you can issue yourself (self-signed) ssl certificate, it won't be insured but at least the information would go in or transfer as encrypted. 使cookie HttpOnly无法被javascript.访问。
您可以通过查看以前的堆栈溢出帖子:How do you set up use HttpOnly cookies in PHP来实现
https://stackoverflow.com/questions/27606382
复制相似问题