- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我们将应用程序从 JBoss 5 迁移到 JBoss6,其中一个主要原因是要利用 servlet 3.0 的新功能。除了 JBoss 6 和 servlet 3.0 的一项新功能外,一切都很好:将 session cookie 设置为仅通过安全通道传输,即使请求是通过纯 HTTP 发出的。这对我们来说是一个非常重要的安全功能,可以通过添加
<secure>true</secure>
在 web.xml 中。这是我们的 web.xml 的一部分:
<session-config>
<session-timeout>25</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
当我们删除
<secure>true</secure>
一切正常。当它存在时,即使在安全页面 (HTTPS) 或不安全页面 (HTTP) 上,也会为每个请求生成一个新的 jsessionid。此外,登录不起作用,因为在使用安全凭据登录后,用户将被重定向回登录页面。
我想这可能也是 Tomcat 7 的一个问题,因为它也使用 servlet 3.0 规范。任何建议将不胜感激。
问候
最佳答案
Secure
Optional. The Secure attribute (with no value) directs the user agent to use only (unspecified) secure means to contact the origin server whenever it sends back this cookie.
The user agent (possibly under the user's control) may determine what level of security it considers appropriate for "secure" cookies. The Secure attribute should be considered security advice from the server to the user agent, indicating that it is in the session's interest to protect the cookie contents.
这意味着规范让浏览器(用户代理)可以定义什么是“安全的”。
web.xml
中的Secure
元素是对HTTP Cookie Secure property 的引用。 ,您可以使用浏览器的调试工具跟踪该值。
如果通信不“安全”,浏览器将不会根据以下请求将收到的 cookie 发送到服务器。
问题不在于 JBoss 总是返回新的 cookie,而是因为通信不安全而没有将其发回的浏览器。 JBoss 然后为每个请求创建一个新 session 。
很明显,对于非加密通信(不是 HTTPS),浏览器不会发送 cookie,这是预期的,因为您将 cookie 标记为 secure = true
。
但是,即使您正在使用 HTTPS,“安全”相对于浏览器的安全概念,例如:
使用 TLS 可能会发生这些和其他安全问题,这意味着通信不安全。
问题一定出在您的 SSL/TLS 或 Cookie 配置上,这意味着您必须检查您的操作并找出问题所在。我认为 JBoss 或 JBossWeb(Tomcat 6 分支)中没有任何错误导致它,并且可以肯定这不是规范错误。
我能够使用 TLS 和您的 web.xml
配置配置 JBoss 6.1.0 Final,一切都按预期工作。
我建议您仔细检查您的配置、浏览器调试和警报。
关于java - 使用 servlet 3.0 的 JBoss 6 session 安全特性的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6479656/
目录 C#特性 1. 概括 2. 语法 定义特性类 应用特性
是否有关于 Python 语言必须提供哪些功能的文章/论文?为什么应该使用 Python 而不是任何其他语言? Python 的优点和缺点是什么? 最佳答案 Why Python和 Why Pytho
我想弄清楚为什么 .x比*.x具有更高的特异性当后者有望获胜时。 不是*.x应该具有 0-0-1-1 的特异性(1 个类,1 个标签)而 .x只是一个类(class) 0-0-1-0 ? 考虑以下基本
在尝试评估非 instanceof 条件时,我发现了我在 Groovy 2.4.7、1.6.0 JVM 中没有预料到的行为。 总之: class Foo { static Boolean
当使用可变结构和属性时,编译器可以解决一些问题,但不能对其他相当明显的事情做同样的事情,这对我来说似乎很奇怪。 以下面的自动属性为例: Vector2 Vector { get; set; } 而不是
我对 ES3 有一定的了解,但我对 ES5 的特性不是很了解。我 - 或多或少 - 知道: Object.create(), Object.freeze() “使用严格” getter 和 sette
我最近开始将 Django 1.5.4 用于带有 MySQL 后端的 Web 应用程序。就在一开始,我遇到了某些限制,这让我想知道 Django 是否是继续前进的正确方法。 一些明显的缺点是: 缺少复
在函数模板的定义中,模板参数的实例化一般是未知的。类型特征可用于在编译时获取一些信息。例如,这是 is_pointer 的一个简单应用: template void foo(T p) { cout
我正在设计页面的样式,该页面具有除最后一个框外的带底部边框的连续框。我为所有框应用类 .box 并添加 .box_last 以仅隐藏最后一个框的边框。 .box { border-bottom-s
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我有兴趣编制一份不建议在嵌入式系统中使用的 c++ 功能列表(这可能会导致人们推荐使用 c 而不是 c++)。如果您知道,请尝试添加原因,或者将您的原因添加到其他人的答案中。 这是一个开始(我知道的唯
作为一名 Ruby 程序员,您是否曾觉得任何使用起来有点冒险的功能,可能是因为它的奇怪行为?它可能有很好的文档记录,但在调试时很难找到,或者难以记住? 我通常尽量远离 String#gsub!。文档说
我正在开发一个连接到健身 watch 的蓝牙应用程序。这是我第一次使用蓝牙。我设法使用出色的 FlutterBlue 将我的应用程序与设备连接起来图书馆。 但是我无法理解我从阅读中获得的结果。这是我阅
1. 迭代器(Iterator)的介绍 背景:指针可以用来遍历存储空间连续的数据结构,但是对于存储空间费连续的,就需要寻找一个行为类似指针的类,来对非数组的数据结构进行遍历。 定义:迭代器是一种检
嗨,伙计们,有没有动态更改 Spring 属性文件内容的好例子?如果您能给我一些示例或链接,我将不胜感激。 非常感谢 最佳答案 我想你可以使用 ReloadableResourceBundleMess
SystemVerilog 引入了一些非常有用的结构来改进编码风格。然而,正如我的一位同事经常说的,“你不是在写软件,你是在描述硬件。”考虑到这一点,当最终结果需要合成时,应该避免语言的哪些特征?这个
我定义了这些测试依赖项 / Test Dependencies lazy val wiremock = "com.github.tomakehurst" % "wir
我正在为 Android 手机和 Android watch (wearOS) 编写应用程序。这些应用程序将通过蓝牙相互通信。基本上,Android 手机上的应用程序将与 WearOS 设备绑定(bi
我正在为 Android 手机和 Android watch (wearOS) 编写应用程序。这些应用程序将通过蓝牙相互通信。基本上,Android 手机上的应用程序将与 WearOS 设备绑定(bi
我有兴趣提高我的设计能力(设计具有属性、方法等的类)。即如何决定类、方法和属性应该是什么? 你们能建议我改进这个的好 Material 吗? 最佳答案 请看: Any source of good o
我是一名优秀的程序员,十分优秀!