<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic correct way to provide the ticket in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165474#M119152</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the way I chose to handle authentification&amp;nbsp; is:&lt;/SPAN&gt;&lt;OL style="list-style-type:decimal;"&gt;&lt;LI&gt;get the ticket from &lt;EM&gt;AuthenticationUtils.startSession(username, password);&lt;/EM&gt; during the first request&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;in the subsequent requests pass the ticket (saved in the session) to the &lt;EM&gt;AuthenticationCallbackHandler&lt;/EM&gt;; all webservice calls will get the ticket from the latter&lt;/LI&gt;&lt;/OL&gt;&lt;SPAN&gt;That's only 2 steps and with the CallbackHandler quite elegant though "hacky", since I had to write my own one, because the original one has no &lt;/SPAN&gt;&lt;EM&gt;setTicket()&lt;/EM&gt;&lt;SPAN&gt;-method. As described in &lt;/SPAN&gt;&lt;A href="http://forums.alfresco.com/viewtopic.php?t=11204" rel="nofollow noopener noreferrer"&gt;this post&lt;/A&gt;&lt;SPAN&gt; that way works only most of the times and moreover causes problems when putting alfresco and my application on different servers (may be sth. different though).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sylvain78 proposed &lt;/SPAN&gt;&lt;A href="http://forums.alfresco.com/viewtopic.php?t=8363" rel="nofollow noopener noreferrer"&gt;another approach&lt;/A&gt;&lt;SPAN&gt;: again using &lt;/SPAN&gt;&lt;EM&gt;startSession(user, pass)&lt;/EM&gt;&lt;SPAN&gt;, storing the ticket and then providing it by creating the services with it as an argument, e.g.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;repositoryService = (RepositoryServiceSoapBindingStub)locator.getRepositoryService();&lt;BR /&gt;repositoryService.setPassword(details.getTicket());&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;A third approach I found in theses forums was to create and destroy a session for each request. That would be quite easy, however, supposedly not elegant nor fast. Moreover, you have to store the user's password somewhere to re-authenticate and send it over the network over and over again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;What now is the correct way to authenticate?&lt;/STRONG&gt;&lt;SPAN&gt; (Perhaps it helps to know that I develop an application running on a tomcat. The user sends requests to my application which then asks alfresco. The ticket is stored in the user's session of my application. So from alfresco's point of view my application is the client which is proud owner of an alfresco ticket…)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim-Erwin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2008 15:29:10 GMT</pubDate>
    <dc:creator>tim-erwin</dc:creator>
    <dc:date>2008-02-26T15:29:10Z</dc:date>
    <item>
      <title>correct way to provide the ticket</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165474#M119152</link>
      <description>Hi,the way I chose to handle authentification&amp;nbsp; is:get the ticket from AuthenticationUtils.startSession(username, password); during the first requestin the subsequent requests pass the ticket (saved in the session) to the AuthenticationCallbackHandler; all webservice calls will get the ticket from th</description>
      <pubDate>Tue, 26 Feb 2008 15:29:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165474#M119152</guid>
      <dc:creator>tim-erwin</dc:creator>
      <dc:date>2008-02-26T15:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: correct way to provide the ticket</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165475#M119153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've had a look at this issue and I can see your problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment the AuthenticationUtils callback method assumes that the ticket will come from the ThreadLocal held in that class.&amp;nbsp; If this is not the case it becomes tricky.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the correct way to resolve this is to create an interface called TicketProvider with one method getTicket().&amp;nbsp; The AuthenticationUtils class could then be provided with a ticket provider and it would use that implementation to get the ticket in the callback method. (instead of the method on AuthenticationUtils)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The default ticketProvider would be implemented to retrieve the ticket in the current manner, but if you wanted a different mechanism you could implement the interface and set your implemenation as the ticket provider to be used instead.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've created a JIRA issue relating to this change.&amp;nbsp; If you get to it before I do then please feel free to make the change locally and add details of the changes to the JIRA ticket.&amp;nbsp; This will help to speed up the process of getting the change into the main build.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Roy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: You can find the JIRA issue here … &lt;/SPAN&gt;&lt;A href="http://issues.alfresco.com/browse/AR-2150" rel="nofollow noopener noreferrer"&gt;http://issues.alfresco.com/browse/AR-2150&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2008 13:58:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165475#M119153</guid>
      <dc:creator>rwetherall</dc:creator>
      <dc:date>2008-03-06T13:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: correct way to provide the ticket</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165476#M119154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does this mean there is no way to resolve the ticket issue in the current release without modifying Alfresco code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If so - how can we use the Web Services?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am struggling with this issue right now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 11:50:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165476#M119154</guid>
      <dc:creator>mcirwin</dc:creator>
      <dc:date>2008-05-06T11:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: correct way to provide the ticket</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165477#M119155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi McIrwin,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;there is a way. It just means to re-implement some code. It's mainly copy and paste, however. As mentioned above there is the &lt;/SPAN&gt;&lt;A href="http://forums.alfresco.com/viewtopic.php?t=8363" rel="nofollow noopener noreferrer"&gt;way sylvian78 did it&lt;/A&gt;&lt;SPAN&gt;. That however means that you have to provide either the ticket or ticketified services throughout your application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I implemented my own ticket callback handler (again, mainly copy and paste from AuthenticationUtils). Provide the services with the correct&amp;nbsp; &lt;/SPAN&gt;&lt;EM&gt;WS_SECURITY_INFO&lt;/EM&gt;&lt;SPAN&gt; (containing your callback handler and remove the cookie handler) and you are done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@Roy: Did not have time to fully implement that small thing, started it, but may still take some time…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards and good luck,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim-Erwin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Hey, I replied to your post before you even wrote it, nice, uh? &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/EM&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 21:33:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165477#M119155</guid>
      <dc:creator>tim-erwin</dc:creator>
      <dc:date>2008-05-06T21:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: correct way to provide the ticket</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165478#M119156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Tim, I'll give that a try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One thing I did was implement my own AuthenticationUtils and give that a "setAuthenticationDetails" method.&amp;nbsp; I then saved my authenticationDetails from a successful login.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I call that set method immediately before trying anything,it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;repositoryService = WebServiceFactory.getRepositoryService();&lt;BR /&gt;repositoryService.setPassword(m_ticket);&lt;BR /&gt;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Reference spacesStoreRef = new Reference();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;spacesStoreRef.setStore(m_spacesStore);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;spacesStoreRef.setPath("/");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;AuthenticationUtils.setAuthenticationDetails(m_authDetails);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;QueryResult qr = repositoryService.queryChildren(spacesStoreRef);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return getObjectImp(qr);&lt;BR /&gt;}&lt;BR /&gt;catch (RemoteException re)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_log.error("Remote exception", re);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RException(0,re);&lt;BR /&gt;}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 10:20:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/correct-way-to-provide-the-ticket/m-p/165478#M119156</guid>
      <dc:creator>mcirwin</dc:creator>
      <dc:date>2008-05-07T10:20:52Z</dc:date>
    </item>
  </channel>
</rss>

