Alfresco Authentication in Web Scripts

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2009 10:41 AM
Hi,
We are facing problems with web script authentication. We are unable to understand what differences /service, /wcservice and /168service cause.
We are interfacing Liferay with Alfresco 3.0.0 Stable(LDAP configured) using AWPr portlets. The basic webscript we are trying to configure is an upload webscript. We are not using the all-in-one MySpaces Web script and implementing Upload and Browse separately. We found the Upload script on the Web Script Examples Wiki entry. But sending alf_ticket is not automatically authenticating the user. The Authentication level for the scripts is set at "user".
The script worked once and the uploaded file was stored in the ticket holding user's folder. The script never worked like that again. Sorry if it's sounding like a ghost story. But this is exactly what happened. No changed were made yet, the script then stopped functioning like it was supposed to.
Pls help, thanks
Anup
We are facing problems with web script authentication. We are unable to understand what differences /service, /wcservice and /168service cause.
We are interfacing Liferay with Alfresco 3.0.0 Stable(LDAP configured) using AWPr portlets. The basic webscript we are trying to configure is an upload webscript. We are not using the all-in-one MySpaces Web script and implementing Upload and Browse separately. We found the Upload script on the Web Script Examples Wiki entry. But sending alf_ticket is not automatically authenticating the user. The Authentication level for the scripts is set at "user".
The script worked once and the uploaded file was stored in the ticket holding user's folder. The script never worked like that again. Sorry if it's sounding like a ghost story. But this is exactly what happened. No changed were made yet, the script then stopped functioning like it was supposed to.
Pls help, thanks
Anup
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2009 10:57 AM
You can easily expose your WebScript as a portlet in a portlet container using WebScriptPortlet class provided from Alfresco:
http://wiki.alfresco.com/wiki/3.0_Web_Scripts_Framework#JSR-168_Runtime
In this way you can use the right authenticator:
Otherwise you can execute any WebScripts in your custom portlet using HttpClient, but you must manage the response with the correctly output result.
If you execute a WebScript with "alfresco/service/" path the authentication process restart for any session and users (if required).
If you execute a WebScript with "alfresco/wcservice/" path you are referring a WebScript but users can execute this WebScript only with the same user session that it is the same Alfresco Web Client session.
Hope this helps.
http://wiki.alfresco.com/wiki/3.0_Web_Scripts_Framework#JSR-168_Runtime
In this way you can use the right authenticator:
webscripts.authenticator.jsr168.webclient
Otherwise you can execute any WebScripts in your custom portlet using HttpClient, but you must manage the response with the correctly output result.
If you execute a WebScript with "alfresco/service/" path the authentication process restart for any session and users (if required).
If you execute a WebScript with "alfresco/wcservice/" path you are referring a WebScript but users can execute this WebScript only with the same user session that it is the same Alfresco Web Client session.
Hope this helps.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2009 02:44 AM
Thanks OpenPj.
We now have the web script running from Liferay! We modified the Example code to an iframe based upload so that the page doesn't change on Submitting the upload form, also the companyhome.create(… was changed to userhome.create. The upload is working, we are using the /168service/ for this. The current problem is that the upload is going into the Company Home instead of the ticket holder's folder inside User Homes. We want the upload of the currently authenticated user to go into the User's folder only and not into Company home. Within Alfresco, the user can only upload to his space, but via Web Script Portlet in Liferay this is not the case and uploads are going into Company Home.
Any suggestions on how to solve this problem?
Setup-
Alfresco running on 8180, ajp13 port 8010
Liferay running on 8080, ajp13 port 8009
Apache using mod_jk to provide common domain to both servers, configured to forward http://localhost/alfresco/* to alfresco-tomcat and http://localhost/* to liferay
Thanks,
Anup
We now have the web script running from Liferay! We modified the Example code to an iframe based upload so that the page doesn't change on Submitting the upload form, also the companyhome.create(… was changed to userhome.create. The upload is working, we are using the /168service/ for this. The current problem is that the upload is going into the Company Home instead of the ticket holder's folder inside User Homes. We want the upload of the currently authenticated user to go into the User's folder only and not into Company home. Within Alfresco, the user can only upload to his space, but via Web Script Portlet in Liferay this is not the case and uploads are going into Company Home.
Any suggestions on how to solve this problem?
Setup-
Alfresco running on 8180, ajp13 port 8010
Liferay running on 8080, ajp13 port 8009
Apache using mod_jk to provide common domain to both servers, configured to forward http://localhost/alfresco/* to alfresco-tomcat and http://localhost/* to liferay
Thanks,
Anup
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2009 08:28 AM
You can try to use the Alfresco Ticket in an explicit way, from your WebScript you can get Ticket from Alfresco session in this way using Javascript with an Ajax call:
Hope this helps.
var myTicket = "${session.ticket}";var webscriptUrl = "${url.serviceContext}" + "/yourCustomUrl?&ticket="+myTicket;
You can try to use it for all the calls that you woudl like to invoke on Alfresco from a portlet container.Hope this helps.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2011 05:16 PM
How about a java backed webscript? how can I use the current session to use the services in the webscript in java (i.e. use WebServiceFactory by authenticating: AuthenticationUtils.startSession(logged_usr, logged_pwd);
