简体   繁体   English

ASP.NET Forms身份验证 - 记住我的问题

[英]ASP.NET Forms Authentication - Remember Me issue

I am using "Remember Me" in my Forms Authentication for my ASP.NET webapp. 我在我的ASP.NET webapp的Forms身份验证中使用“记住我”。 If I login with valid credentials and select "Remember Me", i can log in and everything is fine. 如果我使用有效凭据登录并选择“记住我”,我可以登录,一切都很好。 Now if i close the window, open SQL server and change password and then try to open the webapp, it bypasses login process and uses my old cached credentials from "Remember Me" and allows me to log in. 现在,如果我关闭窗口,打开SQL服务器并更改密码然后尝试打开webapp,它会绕过登录过程并使用“记住我”中的旧缓存凭据并允许我登录。

Is that normal behavior? 这是正常的行为吗? If so, the only thing I can think of is removing "Remember Me" option or using a very short expiration time. 如果是这样,我唯一能想到的就是删除“记住我”选项或使用非常短的过期时间。

Any suggestions? 有什么建议?

This is normal. 这个是正常的。 The reason is that in order to remember a user, some form of key needs to be stored on the client machine allowing the login process to be bypassed. 原因是为了记住用户,需要将某种形式的密钥存储在客户端机器上以允许绕过登录过程。 Assuming that you are using ASP.NET's integrated membership functionality, you essentially have a unique token stored in the cookie which identifies the user. 假设您使用的是ASP.NET的集成成员资格功能,那么您实际上在cookie中存储了一个标识用户的唯一令牌。 This has nothing to do with the password, for various good reasons. 由于各种原因,这与密码无关。 What this means is that the automatic login is password-independent, so changing it shouldn't logically affect this feature. 这意味着自动登录与密码无关,因此更改它不应在逻辑上影响此功能。

If security is a concern you can indeed look at shortening the time span in which the remembering remains valid. 如果担心安全问题,您确实可以考虑缩短记忆保持有效的时间跨度。 Or as you mentioned you can simply eschew this feature altogether if it poses too much of a risk. 或者正如您所提到的,如果它具有太大的风险,您可以完全避开此功能。 Password remembering is a common feature implemented on the vast majority of websites, and provided that you are using ASP.NET's integrated membership functionality, your security risks are minimised, but in the end you need to examine your particular case and determine whether this feature makes sense for you. 密码记忆是在绝大多数网站上实现的常见功能,如果您使用ASP.NET的集成成员身份功能,您的安全风险将被最小化,但最终您需要检查您的特定情况并确定此功能是否使感觉适合你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM