cancel
Showing results for 
Search instead for 
Did you mean: 

Pb : Add a ticket to an Alfresco url to avoid logging

sam69
Champ in-the-making
Champ in-the-making
Hello !

I want to provide a link from my webapp, pointing to an Alfresco space or document.
But I want to avoid the user to login again (as the user is already logged on my website).
So the ticket url argument looks like what I need :
http://wiki.alfresco.com/wiki/URL_Addressability#Ticket_URL_Argument

I manage to get a ticket through webservice, and append it to my url, but it  doesn't work.
Here is my test code :

//get ticket :
    String ticket = WebServiceFactory.getAuthenticationService().startSession("admin", "admin").getTicket();
    //remove "TICKET_" prefixe and add "?ticket="
    ticket = "?ticket=" + ticket.substring("TICKET_".length());
    String urlDetail = "http://dimension_1:8080/alfresco/navigate/showDocDetails/workspace/SpacesStore/66c17658-01fd-11db-ac..." + ticket;
    System.out.println(urlDetail);
    String urlDownload = "http://dimension_1:8080/alfresco/download/attach/workspace/SpacesStore/66c17658-01fd-11db-ac8c-fd68b...;
    System.out.println(urlDownload);
I got my 2 urls :
http://dimension_1:8080/alfresco/navigate/showDocDetails/workspace/SpacesStore/66c17658-01fd-11db-ac...
http://dimension_1:8080/alfresco/download/attach/workspace/SpacesStore/66c17658-01fd-11db-ac8c-fd68b...
Just after, I past it in IE -> I have a servlet exception :

java.lang.IllegalStateException: Impossible de cr?er une sessionapr?s que la r?ponse ait ?t? envoy?e
Translation of the message : Unable to create a session after response has been sent.
org.apache.catalina.connector.Request.doGetSession(Request.java:2206)
   org.apache.catalina.connector.Request.getSession(Request.java:2024)
   org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:831)
   org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:842)
   org.alfresco.web.app.servlet.BaseServlet.redirectToLoginPage(BaseServlet.java:158)
   org.alfresco.web.app.servlet.BaseServlet.servletAuthenticate(BaseServlet.java:129)
   org.alfresco.web.app.servlet.DownloadContentServlet.doGet(DownloadContentServlet.java:108)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

And when I try the urls in firefox, I don't have an exception but I get the alfresco's identification screen. If I login, it show the right page.

I run the 1.4.0 version of alfresco on Windows XP Pro.

Does the ticket argument is working ? Somebody manage to get it work with a ticket obtain from web services ?

Thanks,
Samuel
13 REPLIES 13

bindiya
Champ in-the-making
Champ in-the-making
Thanks Samuel.

It was of great help to me. It works fine now.

Thanks,
Bindiya

sam69
Champ in-the-making
Champ in-the-making
no problem Smiley Wink

jtorres
Champ in-the-making
Champ in-the-making
Every day I learn something new  :roll: , Alfresco is really a big project. Thanks folks.

lalli
Champ in-the-making
Champ in-the-making
Hi,

Now I opened a first document using the ticket url in my application.
Now there is a link in my first document which is pointing to the document in alfresco (and link has the absolute path of the second document in alfresco) and the user has read permission.

But when I click on the link in the first document it asks me again to login again though I had logged in to alfresco using webservices call to open the first document in my application.

I need this help ASAP.
Thanx in advance.

-Lalli.