当用户注销后回来时验证用户
我们正在使用 Struts 1.2 开发一个 Web 应用程序。在该应用程序中,当用户按下注销时,它将注销用户,但是当他按下后退按钮时,它将带他进入而不询问用户名和密码。同样,当我们登录后给出页面的 url 时,它会在不验证的情况下将他带入其中。
我不知道如何解决这种安全问题。请指导我。
we are developing a web application using Struts 1.2. In that application, when user presses logout, it will logout the user,but when he presses back button, it will take him inside without asking for username and password. Likewise, when we give the url of the page after login, it will take him inside without verification.
I dont know how to reolve this kind of security problem. Please guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是如何实施注销操作的?如果您正在实现自己的(例如,不使用 Spring Security 等),则应该在用户注销时调用
session.invalidate();
。当然,当您的用户点击后退按钮时,由于浏览器缓存,他们可能仍然会看到该页面(取决于如何实现注销操作),但当他们之后尝试访问安全页面时,他们将无法访问该页面。How did you implement your logout action? If you are implementing your own (say, without using Spring Security, etc), you should be invoking
session.invalidate();
when the user is logging out. Sure, when your user hits the back button, they might still see the page due to browser caching (depending how to implement the log out action) but when they try to access a secure page after that, they will not have access to it.