如何测试 httpOnly cookie 标志

发布于 2024-10-05 01:45:34 字数 155 浏览 0 评论 0原文

我在 websphere 中为 jsession cookie 设置了以下属性 com.ibm.ws.webcontainer.HTTPOnlyCookies

知道如何在 Firefox 或 IE 中使用 JavaScript 进行最佳测试吗?

I have set the following property in websphere for the jsession cookie
com.ibm.ws.webcontainer.HTTPOnlyCookies.

Any idea how best to test this using JavaScript in Firefox or IE?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

平安喜乐 2024-10-12 01:45:34

在 IE 中这是一个痛苦。我有 IE9,所以你的屏幕可能会有所不同。

按 F12,转到网络选项卡,然后按开始捕获。返回 IE,然后打开您要查看的页面。返回 F12 窗口,您可以看到所有单独的 HTTP 请求,选择您正在检查 cookie 的页面或资产,然后双击它。然后,您应该能够在相关选项卡上看到所有响应标头和 cookie。


编辑:

HttpOnly Cookie 看起来像这样:

Set-Cookie: SessionId=z5ymkk45aworjo2l31tlhqqv;路径=/; HttpOnly

Cookie 可能不会随每个响应一起发送,因此您可能需要清除所有 Cookie,然后重试以确保与您正在监控的请求一起发送 Cookie。

It's a pain in IE. I have IE9 so your screens may be different.

Press F12, go to the network tab, and then press Start Capturing. Back in IE then open the page you want to view. Back in the F12 window you show see all the individual HTTP requests, select the one that's the page or asset you're checking the cookies on and double click on it. You should then be able to see all the response headers and cookies on their relevant tabs.


Edit:

A HttpOnly Cookie would look something like this:

Set-Cookie: SessionId=z5ymkk45aworjo2l31tlhqqv; path=/; HttpOnly

The cookie may not be sent with every response, so you may need to clear all of your cookies and then try again to make sure one is sent with the request you're monitoring.

小梨窩很甜 2024-10-12 01:45:34

Firebug - 单击 Cookie 选项卡

Firebug - click on the Cookies tab

烂人 2024-10-12 01:45:34

firecookie for firefox 给了我答案。

firecookie for firefox gives me the answer.

吹梦到西洲 2024-10-12 01:45:34

在 Chrome 或 Firefox 上执行此操作的最简单方法如下:

  • 打开页面,例如 somedomain.com
  • 通过右键单击页面,然后单击 打开 dev 工具>InspectInspect Element
  • 单击 Network 选项卡
  • 单击任何实际请求并转到 Headers 部分
  • 现在查找 < response headers 中的 code>set-cookie

下面是详细截图
输入图片此处描述

The easiest way to do it on Chrome or Firefox is as below:

  • Open the page for instance somedomain.com
  • Open dev tools by right clicking on page and then clicking on Inspect or Inspect Element
  • Click on Network tab
  • Click on any of the actual request and go to Headers section
  • Now look for set-cookie in response headers

Here is the screenshot for details
enter image description here

药祭#氼 2024-10-12 01:45:34

将以下行添加到您的应用程序中
细绳

sessionid = request.getSession().getId();
response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; secure; HttpOnly");

add the following lines to your app
String

sessionid = request.getSession().getId();
response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; secure; HttpOnly");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文