zoukankan      html  css  js  c++  java
  • 会话标识未更新

    IBM appcsan扫描安全漏洞--会话标识未更新

    appcsan修订建议:

    始终生成新的会话,供用户成功认证时登录。 防止用户操纵会话标识。 请勿接受用户浏览器登录时所提供的会话标识

    在登录验证成功之后调用下面方法

    @SuppressWarnings("unchecked")
        private void createNewSession(HttpServletRequest request, HttpServletResponse response) throws Exception {
            HttpSession oldSession = request.getSession();
            // get the content of old session.
            Enumeration<String> attributeNames = oldSession.getAttributeNames();
            Map<String, Object> attributeMap = new HashMap<String, Object>();
            while(attributeNames != null && attributeNames.hasMoreElements()){
                String attributeName = attributeNames.nextElement();
                attributeMap.put(attributeName, oldSession.getAttribute(attributeName));
            }
            oldSession.invalidate();
            HttpSession newSession = request.getSession(true);
            // put the content into the new session.
            for (String key : attributeMap.keySet()) {
                newSession.setAttribute(key, attributeMap.get(key));
            }
        }
  • 相关阅读:
    MongoDB中常用的find
    MongoDB文档的增删改操作
    我的notepad++
    MongoDB入门知识
    Python基础5-常用模块
    Python基础4
    Python基础3(2017-07-20)
    Python基础2(2017-07-18)
    Python基础1(2017-07-16)
    Python简介(2017-07-16)
  • 原文地址:https://www.cnblogs.com/jimor/p/3418070.html
Copyright © 2011-2022 走看看