cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent:How to validate ticket using Alfresco Web Service API

itsard
Champ in-the-making
Champ in-the-making
Hi,
How do I validate ticket using Alfresco Web Service APIs.I can get a ticket after authenticating the user but how do I pass that ticket
to the subsequent api calls as those apis dont have ticket parameter as an argument.
The Rivet apis that I have checked have the ticket parameter as an argument. Is that an advantage of the Rivet api
over the web service api.
24 REPLIES 24

cheffilet
Champ in-the-making
Champ in-the-making
This is not necessary i guess.

Firstly if you retrieved a valid ticket you got a AuthenticationDetails-Object along with that:


AuthenticationDetails details = AuthenticationUtils.startSession(…, …);


This have to be bind to the current local thread and must be released after the last WebService-Call(e.g. within the finally-block).

If you execute following line, you dont have to "validate a ticket" as its posses a infinite lifetime - per default! You can change this by editing the file authentication-services-context.xml.

itsard
Champ in-the-making
Champ in-the-making
But then everytime i will have to pass the username and password.
I wish to authenticate just once and using the ticket generated, validate the user on every api call.
The web service api dont provide any api for validating a ticket?

cheffilet
Champ in-the-making
Champ in-the-making
You can do following:

1. Start a session.
2. Save authenticationDetails in the back.
3. Implement a SessionHTTPListener
4. In Method sessionDestroyed of SessionHTTPListener.sessionDestroyed invalidate ticket (with backing authenticationDetails).

itsard
Champ in-the-making
Champ in-the-making
Hi,
Can you kindly guide me which is better: The web service api or the rivet api.
My requirement is calling the DMS apis of alfresco from my project deployed in oc4j server.
The user might log in just once in my system and his authentication should be allowed in alfresco server and for
subsequent calls the ticket should be validated so that he doesnt need to pass the login name and pwd again.
Which of the two options for api to go for?
All the documents stored in alfresco should be saved or updated through that users credentials and not through a
single admin login so that the track can be maintained.

cheffilet
Champ in-the-making
Champ in-the-making
I dont know anything about rivit-api.

But your requirements seems for me easily to handle with Alfresco-WS-API. Alfresco manages all authentication-issues for you so the logged user is surely the user that is the current effective user within Alfresco.

My previous post descripes the approach on implementing a single-login-method.

If its not enough or you miss something, write again - im still there 😉

itsard
Champ in-the-making
Champ in-the-making
This have to be bind to the current local thread and must be released after the last WebService-Call
Can u let me know how do i bind a ticket or authentication details to the current local thread. I cant see the api.
I need the line of code.

cheffilet
Champ in-the-making
Champ in-the-making
At first authenticate with Alfresco. Secondly you have to pass the returned AuthenticationDetails to the LocalThread using Alfresco-API:


AuthenticationDetails details = AuthenticationUtils.startSession("username", "pass123");
AuthenticationUtils.setAuthenticationDetails(details);

Now you can start with your WS-Calls against Alfresco!

itsard
Champ in-the-making
Champ in-the-making
Hi,
Can u help me with this…
I need to search a document in Alfresco repository.
Below is the code am using.
Query query1 =new Query(Constants.QUERY_LANG_LUCENE,"PATH:\"/app:company_home/cm:sample_folder/cm:"+ISO9075.encode(lStringFileName)+"\"");
Whether I use the ISO9075.encode or not it gives random result.Sometimes it finds the doc and sometime doesnt. There is some prob with the documents having "_,digits,spaces" in their names.
Can u let me know the code for searching a document in the repository.
Thanks.

cheffilet
Champ in-the-making
Champ in-the-making
Browsing from external in Alfresco can always occures such issues because of different  encodings. Instead of using a filename can you use the nodeRef?