Предотвращение восстановления сеанса после выхода из системы - PullRequest
0 голосов
/ 24 января 2020

У меня есть эта проблема. Когда я пытаюсь выйти из приложения, я делаю сессию недействительной, и она удаляется. Но если я скопировал эту идентификацию до того, как смогу, то (после выхода из системы) изменить сайт после скопированного сеанса ID и приложение работает. Я хочу избежать этой ситуации.

Это то, что у меня есть в моем выходе из системы. jsp

Короче говоря, смысл не в том, чтобы иметь возможность использовать старый сеанс в приложение

Буду благодарен за любую помощь.

   <%
//clear cookies
Cookie[] cookies = request.getCookies();
if(cookies != null){
       for (Cookie cookie : cookies) {
           cookie.setMaxAge(0);
           cookie.setValue(null);
           cookie.setPath("/");
           response.addCookie(cookie);

       }
}
 // remove all sessionAttributes
try {
    while (request.getAttributeNames().hasMoreElements()) {
        String key = request.getAttributeNames().nextElement().toString();
        System.out.println(
                " WebUtil chearCache key:{}" + key + ": " + request.getAttribute(key));
        request.removeAttribute(key);
        System.out.println(" aip WebUtil removeAttribute key:{}" + key);
    }
} catch (Exception e) {
    System.out.println(" chearCache error {}" + e.getMessage());
    e.printStackTrace();
}

 //preventing cache
response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility

// delete session
request.getSession(false).invalidate();


%>
...