maxInactiveInterval后,Jboss SSO会话不会被销毁

时间:2018-05-24 15:50:44

标签: java session jboss single-sign-on jboss6.x

我们已经在JBoss EPA 6.4.17群集中成功配置了SSO。

每个用户会话都配置了1分钟的 maxInactiveInterval 。 因此,客户端将每隔30秒继续向服务器发送一个活动请求,以使会话保持活动状态。 我已经验证了Jboss缓存中的会话在手动注销时被清除。类似地,关闭选项卡和关闭浏览器操作得到妥善处理。

如果我终止浏览器进程或终止与服务器的客户端连接,则应在1分钟后从服务器销毁缓存。 因为会话的maxInactiveInterval是1分钟。但它没有按预期被破坏。

  • 关于调试。我找到了以下

    1. Jboss线程继续运行以检查会话的有效性。即ContainerBase.ContainerBackgroundProcessor
    2. 此主题将检查会话有效性。如果会话理想时间大于maxInactiveInterval,它将使会话到期。
    3. 默认情况下,Jboss会话 maxEmptyLife 为30分钟。但我使用系统属性将其覆盖为0分钟。所以会议将 被立即销毁。
    4. 手动注销和会话超时操作都在调用session.invalidate();
    5. 然后代码控制到达ClusteredSingleSignOn.java
    6. 中的函数sessionEvent
    7. 在这个sessionEvent()方法中(下面是Jboss源代码),

      // Was the session destroyed as the result of a timeout or
      // the undeployment of the containing webapp?
      // If so, we'll just remove the expired session from the
      // SSO. If the session was logged out, we'll log out
      // of all sessions associated with the SSO.
      boolean timedOut;
      boolean stopped = false;
      if ((timedOut = isSessionTimedOut(session)) || (stopped = isManagerStopped(session))) {
          WebLogger.WEB_SSO_LOGGER.tracef("remove session %s from SSO %s, isSessionTimedOut=%s, isManagerStopped=%s", session, ssoId, timedOut, stopped);
      
          removeSession(ssoId, session);
      
          // Quite poor. We hijack the caller thread (the Tomcat background thread)
          // to do our cleanup of expired sessions
          processExpires();
      } else {
          WebLogger.WEB_SSO_LOGGER.tracef("user logged out of SSO %s", ssoId);
          // The session was logged out.
          logout(ssoId);
      }
      
    8. 控制在会话超时中转到IF块并在手动注销时转到ELSE块。

      1. 在IF BLOCK中调用processExpires(),用于从Jboss缓存中销毁已经过期的会话,但不要从Jboss缓存中销毁当前会话。
      2. 当会话理想时间大于会话maxInactiveInterval时。控件转到上面代码片段的IF块。这导致Jboss缓存来保持会话。 (但希望从Jboss缓存中销毁会话)
      3. 我在1小时后打开浏览器(通过终止其进程终止)。它提示我用旧状态重新加载窗口。当我按下重新加载。由于浏览器会话在Jboss服务器中被捕获,应用程序会自动登录。但预计会提示登录页面。

这是一个安全问题。在终止客户端浏览器之后,我可以使用像ajax请求这样的curl请求访问服务器。

这是一个存在的问题吗?或者Jboss中的任何修复程序?

0 个答案:

没有答案