开发者

Prevent showing Login screen after user login

开发者 https://www.devze.com 2023-02-18 01:27 出处:网络
Web Apllication shows login screen after logged in when i click back button in bro开发者_StackOverflowwser.

Web Apllication shows login screen after logged in when i click back button in bro开发者_StackOverflowwser.

I am using spring framework. Is there any Solution for this?


Use sessions. If he has logged in, save his username, or id to a session variable. At your login page, make sure to check that session. If it exists, redirect him to another page. Else, login.


I don't recommend using self-implemented authentication tools unless there is a strong reason not to use existing libraries (very rare case, based on my experience).You might want to check out spring-security, a project which could deliver pretty much everything you might need in terms of securing your web application. You definitely can achieve this behavior using this library. Although, it didn't work properly in Mozilla Firefox, if I recall. I guess Mozilla just reads the webapp from cache and doesn't even communicate to the server in such cases. But I might be wrong here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号