简体   繁体   English

如何通过使用重新加载按钮提交用户凭据来避免重新登录?

[英]How to avoid re-login by submitting user credentials using a reload button?

I'm developing a java based web application, I have also added Login/Logout functionality in my application.我正在开发一个基于 Java 的 Web 应用程序,我还在我的应用程序中添加了登录/注销功能。 For Login, user needs to submit the username and password and that will be passed as a query parameter along with the url.对于登录,用户需要提交用户名和密码,并将作为查询参数与 url 一起传递。 But the problem is, even after logout when the client tries to go back to the loginPage using the back button (left arrow) in browser and reloads the LoginPage url, the url along with query parameters (login credentials) is get submitted again.但问题是,即使在客户端尝试使用浏览器中的后退按钮(左箭头)返回 loginPage 并重新加载 LoginPage url 时注销后,该 url 以及查询参数(登录凭据)也会再次提交。 This enables the user to login again.这使用户能够再次登录。

How to prevent this and make the user to re-enter the login credentials?如何防止这种情况并使用户重新输入登录凭据?

Also from this, I can say that client browser stores the url along with the query parameters.同样由此,我可以说客户端浏览器将 url 与查询参数一起存储。

How to avoid the browser from saving/caching my login credentials?如何避免浏览器保存/缓存我的登录凭据?

Thanks in advance!提前致谢! :) :)

<div class="container">
      <form action="Login" method="get">
        <h1>Login</h1>
        <label>Enter your username </label>
        <input type="text" placeholder="username" name="username"/><br /><br />
        <label>Enter your password </label>
        <input type="text" placeholder="password" name="password"/><br /><br />
        <button type="submit" value="Login">Submit</button>
      </form>
 </div>

QueryString with Login Credentials : http://localhost:8080/DemoApp/Login?username=karthik&password=karthik123带有登录凭据的查询字符串:http://localhost:8080/DemoApp/Login?username=karthik&password=karthik123

Never send any credentials via URL parameters of a GET request for multiple reasons:出于多种原因,切勿通过 GET 请求的 URL 参数发送任何凭据:

  1. Caching of URLs is always allowed in the browser.浏览器中始终允许缓存 URL。 If you leave your browser unattended for a moment it may leak your credentials.如果您让浏览器暂时无人看管,它可能会泄露您的凭据。
  2. All infrastructure elements (firewalls, proxies) along the way are always allowed to log URLs for debug purposes.沿途的所有基础设施元素(防火墙、代理)始终允许记录 URL 以用于调试目的。 Credentials may leak because someone turned logging on.凭据可能会因为有人打开登录而泄漏。

Secrets are allowed to be passed via headers or body of requests.允许通过请求头或请求体传递秘密。 Please use POST request to send the credentials.请使用 POST 请求发送凭据。 With a bit of luck this should solve your problem.运气好的话,这应该可以解决您的问题。

暂无
暂无

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

相关问题 当用户使用 Apache Shiro 和 JSP 重新登录时如何重定向到主页 - How to redirect to main page when user re-login using Apache Shiro and JSP 使用 SharedPreferences 和 Firebase 身份验证关闭应用程序时如何防止用户被要求重新登录 - How to prevent users from being asked to re-login when closing the app using SharedPreferences and Firebase Authentication HttpServletRequest.authenticate不要求重新登录 - HttpServletRequest.authenticate not asking for re-login 如何在基于Tomcat FORM的身份验证中使用HTTP POST请求触发重新登录到j_security_check - How to trigger re-login with HTTP POST request to j_security_check in Tomcat FORM based authentication 如果会话到期,请重新登录后继续工作 - If session expires, continue work after re-login 更改活动而无需重新登录asmack - Change activity without having to re-login asmack JAAS,Wildfly 10,Firefox-无法重新登录 - JAAS, Wildfly 10, Firefox - can't re-login 除非关闭浏览器或重新启动我的Glassfish,否则我无法重新登录JSF页面 - I can't re-login to a JSF page unless I close my browser or restart my Glassfish 如何使用系统凭据自动登录该站点? - How to automatically login to the site using system credentials? 重新登录Flex,导致Channel.Connect.Failed错误NetConnection.Call.Failed:HTTP:状态500:URL - Re-login in Flex causing Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM