在会话超时后仍可以调用露天网页脚本吗?

时间:2012-10-02 06:00:36

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

我正在做的是在他们的web.xml文件中设置露天和共享会话超时时间60分钟。

我的方案是

  
      
  1. 当我想在“开始工作流程”页面中启动工作流程时,我会填写所有内容   必要的数据,但不要点击“开始工作流程”按钮。
  2.   
  3. 会话超时后,我点击“开始工作流程”按钮。
  4.   
  5. 第一次打开身份验证框并请求输入用户名   和密码。
  6.   
  7. 我填写了其他用户的用户名和密码。
  8.   
  9. 它使用经过身份验证的其他用户启动工作流程。
  10.   
  11. 会话超时的其他时间,它不会请求身份验证   框,但是为先前请求的经过身份验证的用户执行操作。
  12.   

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

目前使用了四个cookie,即alfLogin,alfUsername2,JSSESSIONID,_alfTest。只有当用户注销时,alfUsername2 cookie才会被删除,而其他cookie将被保留.alfLogin和alfUsername2 cookies的过期时间为7天,其他cookie取决于会话。

会话超时后仍然可以使用露天网页脚本吗?如果是这样,我该如何避免这种情况?

1 个答案:

答案 0 :(得分:1)

虽然我必须回答我自己的问题,但我只想分享我的结果。我要跟踪很多。但答案很简单。

首先,这不是因为cookie。

这个答案不仅仅是点击“开始工作流程”按钮,还包括在分享会话超时后调用alfresco webscript

所有对露天网页的调用均由EndPointProxyController org.springframework.extensions.webscripts.servlet.mvc.EndPointProxyController专门spring-webscripts-1.0.0-sources.jar完成。

handleRequestInternal方法中,如果没有会话且basicHttpAuthChallenge为true,则基本认证框如下所示。

            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.xml endpointController中,进行更改    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>
相关问题