Exit with basic authentication without closing a web browser, for example, banking sites

I need to leave the application after some time of inactivity.

I tried using session.invalidate(); but it does not work as I am using basic authentication and I am redirected to a JSP page where it again asks for a login.
But it does not ask for login credentials, and users directly enter the application. The only way to log out with basic authentication is to close Webbrowser.
I need an API such that after inactivation, say, 10 minutes, it should redirect to one JSP page without closing the browser. For example. for example, banking sites where the session has expired, please log in again. "

0
source share
1 answer

Use the meta update header in conjunction with HttpSession#getMaxInactiveInterval() . It returns the remaining HttpSession lifetime in seconds and what you need in the meta update header.

 <meta http-equiv="refresh" content="${pageContext.session.maxInactiveInterval};url=expired.jsp"> 

Include this title in your HTML <head> . If the session timeout is reached, the browser automatically redirects the page to the specified url , which is located in expired.jsp in the above example.

0
source

All Articles