Search in WebScript with guest authentication

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2009 03:47 PM
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
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
Thanks
Andrea
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 RequestContextnet.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.Thanks
Andrea
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2009 04:43 PM
Setting authentication to "none" is very different to "guest", which is what I believe you need.
Mike
Mike

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2009 03:28 AM
Thanks! Works fine! Seems that refreshing the scripts while Alfresco is running update the ftl and js but not the desc.xml.
Thanks again
Andrea
Thanks again
Andrea
