会话超时后仍然可以调用露天网页脚本吗?
-
12-12-2019 - |
题
我正在做的是在 web.xml 文件中将 alfresco 和 share 的会话超时时间设置为 60 分钟。
我的场景是
- 当我想在“开始工作流”页面中启动工作流程时,我填写所有必要的数据,但不要单击“开始工作流”按钮。
- 会话超时后,我单击“启动工作流程”按钮。
- 在第一次打开身份验证框并请求用户名和密码。
- 我填写了另一个用户的用户名和密码。
- 它与经过身份验证的另一个用户启动工作流程。
- 其他时间,会话超时,它不请求身份验证框,而是针对先前请求的身份验证的用户行动。
所以我认为 为什么会发生???是因为cookie吗??
目前使用了四个cookie,分别是alfLogin、alfUsername2、JSSESSIONID、_alfTest。仅当用户注销时,alfUsername2 cookie 才会被删除,其他 cookie 仍保留。alfLogin 和 alfUsername2 cookie 的过期时间为 7 天,其他 cookie 取决于会话。
会话超时后还可以使用 alfresco Web 脚本吗? 如果是这样,我该如何避免这种情况?
解决方案
虽然我必须回答我自己的问题,但我只想分享我的结果。我必须追踪很多。但答案就是这么简单。
首先,不是因为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
}
我们可以避免这种情况,因为
在
endpointController
的 slingshot-application-context.xml, , 改变 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>