【问题标题】:Can alfresco webscripts still be called after session time out?会话超时后仍然可以调用 alfresco webscripts 吗?
【发布时间】:2012-10-09 19:39:35
【问题描述】:

我正在做的是在他们的 web.xml 文件中将 alfresco 和 share 设置为会话超时时间 60 分钟。

我的场景是

  1. 当我想在 Start Workflow 页面启动一个工作流时,我填写了所有 必要的数据,但不要点击“开始工作流程”按钮。
  2. 会话超时后,我单击此“开始工作流程”按钮。
  3. 第一次,验证框打开并请求用户名 和密码。
  4. 我填写了另一个用户的用户名和密码。
  5. 它使用经过身份验证的其他用户启动工作流。
  6. 其他时间会话超时,不请求认证 框,但代表先前请求的经过身份验证的用户。

所以我想为什么会这样???是因为cookie吗??

目前使用的cookie有四种,分别是alfLogin、alfUsername2、JSSESSIONID、_alfTest。只有当用户退出时,alfUsername2 cookie 才会被删除,其他的会被保留。alfLogin 和 alfUsername2 cookie 的过期时间是 7 天,其他的 cookie 取决于 session。

alfresco web script 会话超时后还能使用吗?如果可以,我该如何避免这种情况?

【问题讨论】:

  • 您的 Alfresco Repository 会话和 Alfresco Share 会话的超时时间是否不同?这或许可以解释您所看到的症状

标签: session-cookies alfresco session-timeout alfresco-share


【解决方案1】:

虽然我必须回答我自己的问题,但我只想分享我的结果。我必须追查很多。但答案就是这么简单。

首先,不是因为cookie。

此答案不仅适用于单击“开始工作流程”按钮,还适用于在共享会话超时后调用 alfresco webscript

所有对 alfresco webscript 的调用都是由 EndPointProxyController 完成的,特别是在 spring-webscripts-1.0.0-sources.jar 中的 org.springframework.extensions.webscripts.servlet.mvc.EndPointProxyController

handleRequestInternal方法中如果没有会话且basicHttpAuthChallenge为真,基本认证框如下图。

            else if (this.basicHttpAuthChallenge || descriptor.getBasicAuth())
            {
                // check for HTTP authorisation request (i.e. RSS feeds, direct links etc.)
                String authorization = req.getHeader("Authorization");
                if (authorization == null || authorization.length() == 0)
                {
                    res.setStatus(HttpServletResponse.SC_UNAUTHORIZED,
                            "No USER_ID found in session and requested endpoint requires authentication.");
                    res.setHeader("WWW-Authenticate", "Basic realm=\"Alfresco\"");

                    // no further processing as authentication is required but not provided
                    // the browser will now prompt the user for appropriate credentials
                    return null;
                }
                else
                {
// other coding
                }   

我们可以避免这种情况

slingshot-application-context.xmlendpointController 中,更改 basicHttpAuthChallenge 为 false。

喜欢

   <!-- Override EndPointProxyController to enable Basic HTTP auth challenge on 401 response -->
   <bean id="endpointController" class="org.springframework.extensions.webscripts.servlet.mvc.EndPointProxyController">
      <property name="cacheSeconds" value="-1" />
      <property name="useExpiresHeader"><value>true</value></property>
      <property name="useCacheControlHeader"><value>true</value></property>
      <property name="configService" ref="web.config" />
      <property name="connectorService" ref="connector.service" />
      <property name="supportedMethods"><null/></property>
      <property name="basicHttpAuthChallenge"><value>false</value></property>
   </bean>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-21
    • 2014-02-21
    • 1970-01-01
    • 1970-01-01
    • 2021-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多