2

I have a webscript to upload and list files which I authenticate via alf_ticket generated using login api of alfresco. I redirect my existing webscript to another webscript which is created using Aikau framework and is a stanalone Aikau Client app to preview the files. When it redirects to authentication page of Aikau(page/ap/ws/document/workspace/SpacesStore/83d72801-6a75-45ab-be8f-99245f3828a5)

it asks for credentials, I want to use the existing ticket generated in my webscript to authenticate the aikau webscript. By looking into login.get.js file of aikau project I couldn't able to identify where I could append ticket.

Bilal Saeed
  • 116
  • 10
  • How did you get the ticket you are talking about? From repo directly ? – Younes Regaieg Aug 01 '16 at 14:26
  • using the api /alfresco/service/api/login?u=username&pw=password&format=json, I used this ticket to login to my alfresco console to access share console via Aikau widget I want to use this same ticket – Bilal Saeed Aug 02 '16 at 04:29
  • I meant: Are you trying to authenticate using your aikau client or have you authenticated elsewhere and are looking for a mean to use that same token in aikau in order to achieve some sso logic? – Younes Regaieg Aug 02 '16 at 06:39
  • I have authenticated elsewhere(my other webscript which is not created on Aikau). – Bilal Saeed Aug 03 '16 at 06:11

1 Answers1

1

It's not clear from your question exactly how you're getting this behaviour. For example, is this all running as customization of Alfresco Share or are you building a standalone Aikau client?

For Share, once you have authenticated by logging in then all WebScript requests should be authorized. Similarly with a standalone Aikau client you should be able to login (using the login page provided by the Maven archetype). In both of these cases authentication and credential persistence is managed by Surf.

Are you trying to render Aikau content as a single WebScript that is invoked via an XHR request? How are you attempting to access your Aikau content?

In general, you shouldn't need to worry about authentication issues as Surf takes care of it all for you, however it sounds like you're trying to do something a little bit unusual. Could you try and provide more context to your question please?

Dave Draper
  • 1,837
  • 11
  • 25
  • I am using standalone Aikau client. I have two webscripts one is created to upload files and files&folders listing. When user clicks on a link of file I am calling my other webscript created using Aikau Client. I am authenticating my first webscript with a ticket generated using login api. I want to use this same ticket to login to Aikau. – Bilal Saeed Aug 03 '16 at 06:06
  • So in your standalone Aikau client, are you logging in via the login page provided? If so, your user should then retain authentication to invoke WebScripts that they have permission to use. It sounds like you're trying to perform some authentication directly in your WebScripts - if so, this would be wrong... can you confirm if you're trying to perform additional authentication beyond basic login to the client? – Dave Draper Aug 03 '16 at 07:12
  • Right now Aikau client is forcing me log in via the login page provided. I am not using external authentication. I use ticket to login to my other webscript by calling this alfresco/service/api/login?u=admin&pw=pswd&format=json I want to use this same ticket to login on Aikau Client. Would it be possible? – Bilal Saeed Aug 03 '16 at 07:35
  • OK... so why are you trying to use the ticket? If you call the WebScript over the /proxy or /service prefixes (depending on if your WebScript is on the repository or the web tier) then Surf will provide the authentication with the request. You shouldn't need to manually provide anything. – Dave Draper Aug 03 '16 at 07:43
  • I don't want to provide Alfresco credentials to clients. I am limiting their access to Alfresco docket with my custom permission parameters. Providing them credentials is like giving access to share console which could be security breach. Actually I am incorporating my webscript with Siebel so all I want is when user is logged into my Siebel based app, that user can be redirected directly to Alfresco. For that I used alf_ticket. – Bilal Saeed Aug 03 '16 at 07:51
  • If Aikau couldn't facilitate me to use previously generated ticket then what could be other option to preview the documents that reside on my parent webscript? I want to preview the documents in a proper web viewer like the one on share console. – Bilal Saeed Aug 03 '16 at 07:55
  • Aikau can preview documents. Are you using any of the existing widgets for providing previews? Also, if you're using a standalone client then you will need to ensure that your DocumentService is configured with rawData set to be true (to bypass the web tier and get node data directly from the repository). All of this is covered in the Aikau tutorial - see this chapter: https://github.com/Alfresco/Aikau/blob/master/tutorial/chapters/Tutorial17.md – Dave Draper Aug 03 '16 at 07:59
  • I am using AlfDocumentPreview widget of Aikau with PDFJs to preview documents. – Bilal Saeed Aug 03 '16 at 08:02
  • I have followed this tutorial to implement this Aikau Client document preview. Docs could be previewed perfectly but all I am asking is to override the authentication mechanism of Aikau Client to use existing ticket. – Bilal Saeed Aug 03 '16 at 08:05
  • OK... if that's what you want to do, then I'm not going to be able to help any further. We have provided a framework in which it should not be necessary to override the authentication mechanism. – Dave Draper Aug 03 '16 at 10:46
  • Anyway thanks for your help. What other option could I adopt to preview the document in my web script without further authetication of share console? Or bypass the authentication basis on my previously generated ticket? – Bilal Saeed Aug 03 '16 at 13:19