cancel
Showing results for 
Search instead for 
Did you mean: 

Addressability - ticket

omegerard
Champ in-the-making
Champ in-the-making
Hi,

I do like the TemplateContentServlet facility. I'd like to use it to develop a custom web interface on top of Alfresco. This works fine for content to be served from the "Guest Home", because you don't need to specify account credentials.

What about content that is protected by a username/password?

The wiki documentation says in a somewhat cryptic way that "ticket - can be supplied as a URL argument to allow authentication for external use". Now, is there anybody out there who can tell me how this argument needs to be suppied?

Thanks

Ludo
8 REPLIES 8

rwetherall
Confirmed Champ
Confirmed Champ
Hi Ludo,

I think the ticket can be passed to this servlet as the parameter ?ticket=the-current-ticket-value appended to the URL.  This is the same way authentication information is also sent to the download servlet.

If you are calling from a web service client then you will have the ticket available to you for the session (supplied by the AuthenticationWebService), otherwise you can get the ticket from the AuthenticationService Java API using getCurrentTicket().

Hope this helps,
Roy

omegerard
Champ in-the-making
Champ in-the-making
Hi Roy

I tested it in a PHP environment. With partial success. The ticket supplied as a parameter in the URL appears to be insufficient. The user needs to be logged on to the web interface for it to take effect.

I use the AuthenticationService PHP API to obtain a ticket from Alfresco (e.g. TICKET_1ce38104-d025-11da-909e-e9c04a70233d). When I add this ticket as a parameter to the TemplateContentServlet URL, I get the following error:

type Exception report

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.alfresco.error.AlfrescoRuntimeException: Error during template servlet processing: Current User is mandatory.
   org.alfresco.web.app.servlet.TemplateContentServlet.doGet(TemplateContentServlet.java:205)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

The full URL used is: http://server:8080/alfresco/template/workspace/SpacesStore/f6670007-ca0a-11da-9d40-1b26ba64545d/work...

Now, if I open up a new tab in my browser to log on to Alfresco via the "standard" web interface, and I reload the URL, the requested content IS displayed in the expected Freemarker template. This appears to work even if I log on with another account as with the one I obtained the ticket.

For your information, I'm testing Alfresco on a Linux platform  (Current version 1.2.1 schema 12 - Installed version 1.2.0 (RC2)  schema 5)

Has anybody else observed a similar behaviour?

Regards

Ludo

omegerard
Champ in-the-making
Champ in-the-making
Hi,

Let me just add one detail which I think is important here:

When the TemplateContentServlet URL produces the reported error message and I log on to Alfresco on another computer (with whatever account), I still get the same error. This sems to point in the direction of a cookie issue.

Regards

Ludo

kevinr
Star Contributor
Star Contributor
Hi Ludo,

OK I've taken a look at this. Looks like there are several different issues:

1. Access of a TemplateContentServlet URL via web-services:
Both the template (bbdb0d02-bf1e-11da-b13d-a3865ffc66cb) and the content(df37eedb-a2c6-11da-8077-1ba20ed81776) referred to in this URL live under the "Guest Home" space and are hence, password free.
I think the problem is that you are missing the "guest=true" URL argument - this is mandatory for the login page not to be displayed by default, which is why it works once you login as admin. If this argument is not being supplied on your URL then you will be getting the login page HTML returned as the response.

2. Use of a TICKET url with the TemplateContentServlet:
http://pc3678.imec.be:8080/alfresco/template/workspace/SpacesStore/f6670007-ca0a-11da-9d40-1b26ba645...
I get an exception report again, despite the fact that content, template and ticket references are correct. However, if I print the URL and copy/paste it in a browser, I get the correct page.
It looks like the TemplateContentServlet is not compatible with TICKET style URL access! Unfortunately the code for the default template model generation requires the "current user" object to be available in the web-session, but the TICKET authentication code path does not perform that step when authenticating an existing TICKET string.

This is a bug. We will raise and fix that issue. Hopefully though the "guest=true" URL argument will allow you to use the servlet for now.

Thanks,

Kevin

kevinr
Star Contributor
Star Contributor
JIRA task for the TICKET issue with TemplateContentServlet:
http://www.alfresco.org/jira/browse/AWC-635

omegerard
Champ in-the-making
Champ in-the-making
Kevin,

Thanks for your reply.

    1. Access of a TemplateContentServlet URL via web-services

    I think the problem is that you are missing the "guest=true" URL argument

    Correct. If I add the argument, there's no login page anymore.

    2. Use of a TICKET url with the TemplateContentServlet:

    This is a bug. We will raise and fix that issue.

    That's a relief. At least, for me.

Ludo

omegerard
Champ in-the-making
Champ in-the-making
Just to let you know that I downloaded a 1.3.0 prerelease version from subversion and tested this again.

I can confirm that the ticket authentication is in working order.

Thanks for dealing with it so promptly.

Ludo

kevinr
Star Contributor
Star Contributor
No problem, it was a bug I introduced after all Smiley Happy

Thanks,

Kevin