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

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

url: http://www.cnblogs.com/jimor/p/3418070.html
posted on 2013-11-11 16:03 jinjinwang

 

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));

        }

    }

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值