浏览器对安全缓存的 Infinispan 缓存寿命的访问未过期

Browser access to the Infinispan Cache Lifespan for Security Cache is not expiring

对于我的应用程序,我结合了 REST 服务;和一个网站。两者都在同一个网络应用程序中。

为了保护两者,我将此安全域添加到我的 standalone.xml。 (MyAuthClass 是一个基本的身份验证扩展,可以连接到第三方系统进行身份验证)

   <subsystem xmlns="urn:jboss:domain:security:1.2">
        <security-domains>
            <security-domain name="my-authentication" cache-type="infinispan">
                <authentication>
                    <login-module code="com.myAuthClass.Impl" flag="required"/>
                </authentication>
            </security-domain>
            <security-domain name="other" cache-type="default">
...

我之前用的是cache-type="default",后来适应了infinispan,所以我可以设置一个life span。据我了解,我像这样设置了一个特殊缓存

<subsystem xmlns="urn:jboss:domain:infinispan:2.0">
        <cache-container name="security" default-cache="auth-cache" module="org.wildfly.clustering.web.infinispan" aliases="standard-security-cache">
            <local-cache name="auth-cache" batching="true">
                <expiration lifespan="10000"/>
            </local-cache>
        </cache-container>

我现在的行为令人沮丧。当我使用 REST 测试工具(如 Poster)时,我发现我存储的主体有 10 秒的到期时间。但是,当我访问该网站并四处浏览并访问相同的 REST 端点时,我没有看到任何超时。

我对这项配置工作还很陌生,所以我想我只是遗漏了一些东西,或者我的浏览器正在做一些我不知道的棘手的保持活动。

有没有人看到过这种行为并且知道在使用 infinispan 和基本身份验证扩展时在浏览器中强制执行超时的解决方案?

写完这个问题我几乎马上就解决了...

在 Standalone.xml 中还有一个网站正在使用的缓存容器。巧妙命名 web

  <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan"> ...

我最后做的是为此也设置缓存过期,现在我似乎得到了预期的行为。我也在安全上下文中保留了过期时间,因为当有人正在使用我们的服务时,这就是导致 REST 超时的原因。

最终网络缓存配置:

        <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
            <local-cache name="passivation" batching="true">
                <expiration lifespan="10000"/>
                <file-store passivation="true" purge="false"/>
            </local-cache>
            <local-cache name="persistent" batching="true">
                <expiration lifespan="10000"/>
                <file-store passivation="false" purge="false"/>
            </local-cache>
        </cache-container>