简体   繁体   中英

How to Destroy Session If Someone leave Page | Spring Boot | AngularJS

I am working on Fintech Application. We want to restrict User and INVALIDATE the session if Back button is used.

We are using AngularJs and Spring boot

Thanks

You'd want to create an API and call it when pressing back button, example:

@Controller
public class SessionController {

    @RequestMapping(value = "/invalidate", method = RequestMethod.POST)
    public void invalidate(HttpServletRequest request) {
        HttpSession session= request.getSession(false);
        if(session != null) {
            session.invalidate();
        }
    }
}

Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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