.net 会话和用户 cookie 持久身份验证

发布于 2024-10-07 23:18:17 字数 199 浏览 0 评论 0原文

场景如下:

用户登录,服务器上创建了一个会话,并在客户端创建了一个身份验证 cookie。

会话超时设置为 20 分钟。

25 分钟不活动后,用户返回网站,因此他的会话不再存在,但身份验证 cookie 仍然存在。

基于 cookie,允许用户自动登录的最佳且安全的方法是什么...

提前感谢您的帮助。

Here is the scenario:

A user is logged on and a Session has been created on the server along with an authentication cookie on the client side.

The Session timeout is set to 20 minutes.

After 25 minutes of inactivity the user goes back onto the website, so his Session does not exist anymore but the authentication cookie still exists.

Based on the cookie what's the best and secured way to allow the user to get signed in automatically...

Thanks in advance for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疏忽 2024-10-14 23:18:17

首先,自动登录,应该是一个选项,有些用户不想要它。

其次,如果用户启用了该选项并且身份验证 cookie 仍然存在,则您只需要创建一个新会话。您不需要真正验证用户身份,只需给他一个 cookie 即可。 :-P。

First, sign on automatically, should be a option, some users doesn't want it.

Second, if the user has that option active and the authentication cookie still exists you only need to create a new session. You don't need to really authenticate the user, just give him a cookie. :-P.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文