0

I just created a web script to get the ticket of Alfresco Share. Steps which I done are;

    1. Created getticket.get.desc.xml

    <webscript>
      <shortname>Get User Ticket</shortname>
      <description>Personalized greeting</description>
      <url>/getticket</url>
      <authentication>user</authentication>
      <negotiate accept="text/html">html</negotiate>
      <negotiate accept="application/json">json</negotiate>
    </webscript>

   2. created getticket.get.html.ftl

         ${session.getTicket()}

I am trying to test external authentication. How can I get the ticket in my jsp page or in the java code?

Boat
  • 515
  • 2
  • 8
  • 28
  • 1
    I'm not clear on what you're trying to do. Could you expand your requirements a bit more, so we can work out where the JSP page fits into your Alfresco + Share + External Authentication setup? – Gagravarr Apr 23 '13 at 12:03
  • I am trying to test External SSO in share from a jsp page. Plesae have a look into the last comment of the post http://forums.alfresco.com/forum/installation-upgrades-configuration-integration/authentication-ldap-sso/external-sso-alfresco , I am just trying to do the same thing. – Boat Apr 23 '13 at 13:13
  • 1
    What URL are you calling to get the ticket? `/alfresco/service/` or `/alfresco/wcservice/` ? Only they're completely different in how they handle authentication... – Gagravarr Apr 23 '13 at 13:51
  • "http://localhost:8080/alfresco/service/getticket" .. please have a look into the link i given. I have written the java code I tried in last comment. – Boat Apr 23 '13 at 14:03
  • 1
    That URL is never going to work! The /services/ endpoint doesn't support that style of authentication, which is why you've had to change the one that Share uses in the share config. Try with the same URL you use with Share (`/wcservice/`) and see – Gagravarr Apr 23 '13 at 15:42
  • Same URL? You mean "localhost:8080/alfresco/wcservice/getticket" ? Its giving HTTP/1.1 500 Internal Server Error. – Boat Apr 24 '13 at 04:20
  • While trying in browser its redirecting to log in screen , like http://localhost:8080/alfresco/faces/jsp/login.jsp?_alfRedirect=%2Falfresco%2Fwcservice%2Fgetticket – Boat Apr 24 '13 at 05:19
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/28780/discussion-between-shibu-and-gagravarr) – Boat Apr 24 '13 at 05:41

1 Answers1

0

You need to first authenticate by calling

localhost:8080/alfresco/service/api/login?u={username}&pw={password?}

This will return the ticket as follows

<ticket>TICKET_VALUE</ticket>

Store the ticket and then append the ticket to subsequent script URL's like so

localhost:8080/alfresco/service/../..?alf_ticket=TICKET_VALUE

aniruddhc
  • 320
  • 1
  • 3
  • 15
  • Thanx for the effort taken for answering. I can't pass password here, I am trying to implement External SSO. So trying with /alfresco/wcservice/getticket . So, I need to get the ticket with out giving credentoals. – Boat Apr 25 '13 at 12:28
  • The /alfresco/wcservice uses the Web Client Authenticator to get authentication from the Web Client. Since you need to have external SSO you will need to authenticate explicitly at some point and store the ticket. You could do that by using the Web Service Client. It uses WebServices and sends the authentication using WS-Security. – aniruddhc Apr 26 '13 at 07:05
  • Then in service definition, what URL should I give? – Boat Apr 26 '13 at 09:02
  • 1
    The URL for WebService is localhost:8080/alfresco/api. The AuthenticationUtils class in the Alfresco SDK can be used to call the WebService. Checkout FirstWebServiceClient in the SDK samples. – aniruddhc Apr 26 '13 at 15:41