本文介绍了JAVA 更改 JSESSIONID cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 JBOSS 5 上使用 JAVA 和 Wicket.我需要更改 JSESSIONID cookie 值以获得在另一个客户端中使用的相同会话(设置另一个客户端的 JSESSIONID).我需要它来验证没有键盘的其他客户端).最好的方法是什么?

I'm using JAVA and Wicket on JBOSS 5.I need to change JSESSIONID cookie value to get the same Session used in another client (setting the other client's JSESSIONID). I need that to authenticate the other client that has no keyboard).What is the best way?

推荐答案

如果你真的想要破解 JSESSIONID(我不推荐),您可以通过以下方式进行:

If you really want to hack the JSESSIONID (which I don't recommend), you can do the following way:

  • 编写 Servlet 过滤器
  • 在该过滤器中为 HttpServletRequest 编写一个包装器(此类的新实例必须传递给 chain.doFilter())(我们称之为 RequestWrapper)
  • RequestWrapper 中覆盖 getSession(boolean) 方法
  • Write a Servlet Filter
  • In that filter write a wrapper for the HttpServletRequest (a new instance of this class must be passed to the chain.doFilter()) (let's call it RequestWrapper)
  • In the RequestWrapper override the getSession(boolean) method

getSession(booelan) 实现中,你必须

  • 确定(并记住)您要与非键盘用户共享"的会话(这应该放在首位)
  • 确定您想要进行更改"时的情况(当您通过某种检查确定您的非键盘用户时)
  • 当您必须更改"时,您可以从 getSession()
  • 返回 remembered 会话

关键时刻是:你如何识别你的非键盘用户?如果你不能安全地做到(从你提供的当前信息我看不到),这是一个安全漏洞.

The key moment is: How do you identify your non-keyboard user? If you can't do it safely (from the current information you provided I cannot see it), it is a security hole.

这篇关于JAVA 更改 JSESSIONID cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 20:04
查看更多