Hi,I wrote a very simple web script in alfresco 3.0. The controller simply get a parameter from the request and set the space variable
var imageSpace = search.findNode("workspace://SpacesStore/" + args["uuid"]);
model.space = imageSpace;
and the ftl template show the images contained in the space.Setting the authentication as user everything works fine. Setting the authentication as none I get this exception
net.sf.acegisecurity.AuthenticationCredentialsNotFoundException - A valid SecureContext was not provided in the RequestContext
net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:477)
….
org.alfresco.error.AlfrescoRuntimeException - Failed to execute search: ID:workspace\://SpacesStore/29b2aa8f\-bd8a\-4bf6\-93eb\-2d75dd3c12dd
org.alfresco.repo.jscript.Search.query(Search.java:451)
The space is the guest home so the permissions are ok. Seems that there's some problem executing the search without the secure context. Looking the source of the RepositoryContainer class I saw that call to clearCurrentSecurityContext()
if (required == RequiredAuthentication.none)
{
// MT-context will pre-authenticate (see MTWebScriptAuthenticationFilter)
if (! AuthenticationUtil.isMtEnabled())
{
// TODO revisit - cleared here, in-lieu of WebClient clear
AuthenticationUtil.clearCurrentSecurityContext();
}
transactionedExecuteAs(script, scriptReq, scriptRes);
}
My question is: is this an error or I have to use another API to perform the search.ThanksAndrea