cancel
Showing results for 
Search instead for 
Did you mean: 

Url Addressability-Direct download to no guest users

sergio
Champ in-the-making
Champ in-the-making
Hi all.

After reading carefully the wiki documentation about the URL Addressability some doubts remain.

My situation is the following:

I have a custom web application that access the Alfresco repository (Alfresco 1.4 but 2.0 in the very next future) calling custom web services published into the Alfresco installation itself. These web services are built on top of the Alfresco core APIs, are public available like other Alfresco ws and execute a specialised task upon the Alfresco repository objects, obviously each ws opens a new session, authenticates the current user, execute a task, then close the session. As a consequence, I suppose the user ticket is available only during the session itself and is automatically destroyed when the session is closed. My custom web application needs to access directly some contents in the Alfresco repository, for both viewing and downloading.

I would like to use the DownloadContentServlet passing a URL with the reference to the content to download, but….
Due to the authentication mechanism, the only way to perform this task is to provide a valid ticket as a parameter to the URL, but I think I am not allowed to do it because I don't have a valid ticket inside my custom web application. So, what other mechanism to download contents should I use?

I tried to use the GuestDownloadContentServlet, it works if and only if the Alfresco content is available to a guest user, but I don't have guest users in my custom web application, I have only registered ones.

So, what is the best solution for my problem?

Perhaps, should I write a custom Java class that uses the Alfresco APIs to authenticate a user and deploy it directly inside the Tomcat installation for my custom web app? Should this class create a new session with the logged user, get a user ticket, invoking the direct download servlet, then close the session?

Hoping someone could help me with this task,

all the best.

Sergio
3 REPLIES 3

sergio
Champ in-the-making
Champ in-the-making
No one interested in replying to this basic problem?

I would like to hear something from the Alfresco engineers.

All the best,

Sergio

kevinr
Star Contributor
Star Contributor
I would like to use the DownloadContentServlet passing a URL with the reference to the content to download, but….
Due to the authentication mechanism, the only way to perform this task is to provide a valid ticket as a parameter to the URL, but I think I am not allowed to do it because I don't have a valid ticket inside my custom web application. So, what other mechanism to download contents should I use?

I tried to use the GuestDownloadContentServlet, it works if and only if the Alfresco content is available to a guest user, but I don't have guest users in my custom web application, I have only registered ones.

So, what is the best solution for my problem?

Perhaps, should I write a custom Java class that uses the Alfresco APIs to authenticate a user and deploy it directly inside the Tomcat installation for my custom web app? Should this class create a new session with the logged user, get a user ticket, invoking the direct download servlet, then close the session?

Yes that is probably the best way. You require a ticket - it is essential for the security of the repository that you login to access the content. A simple webservices call is enough to retrieve a valid ticket.

Thanks,

Kevin

sergio
Champ in-the-making
Champ in-the-making
Thanks Kevin!

At least an answer from the Alfresco engineers.

Cheers,

Sergio