<?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 identity in a webapp in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108203#M75854</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I figured out how to set which user is logged in for the workflow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;processEngine.getIdentityService().setAuthenticatedUserId("kermit");&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;But this code is running as part of a webapplication, and according to the user guide, &lt;/SPAN&gt;&lt;EM&gt;"the ProcessEngine and the services objects are thread safe. So you can keep a reference to 1 of those for a whole server."&lt;/EM&gt;&lt;SPAN&gt; This would mean that all threads / request share the same identity service, and thus that the setAuthenticatedUserId is valid for all threads. But individual requests may be "in the spirit" of different workflow users. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I make sure that setAuthenticatedUserId is not influenced by other threads / request and subsequent calls are executed in context of the user set before?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Sep 2012 14:12:20 GMT</pubDate>
    <dc:creator>tbee</dc:creator>
    <dc:date>2012-09-04T14:12:20Z</dc:date>
    <item>
      <title>identity in a webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108203#M75854</link>
      <description>So I figured out how to set which user is logged in for the workflow&lt;IMG id="smileytongue" class="emoticon emoticon-smileytongue" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;rocessEngine.getIdentityService().setAuthenticatedUserId("kermit");‍‍‍But this code is running as part of a webapplication, and according to the user guide, "the ProcessEngine and the services objects are thread safe. So you can k</description>
      <pubDate>Tue, 04 Sep 2012 14:12:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108203#M75854</guid>
      <dc:creator>tbee</dc:creator>
      <dc:date>2012-09-04T14:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: identity in a webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108204#M75855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This would mean that all threads / request share the same identity service,&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;and thus that the setAuthenticatedUserId is valid for all threads.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;No, look at what the service does… it sets the authenticated userid on the current thread (from the top of my head)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How do I make sure that setAuthenticatedUserId is not influenced by other threads / request and subsequent calls are executed in context of the user set before?&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Nothing, see previous answer&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Sep 2012 19:17:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108204#M75855</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2012-09-04T19:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: identity in a webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108205#M75856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, then, is there a way to get the active workflow user? Because, as far as I can tell, it is good practice to first claim a task before completing it. But claim requires the user name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;processEngine.getTaskService().claim(taskId, username);&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not see a getAuthenticatedUserId() on the IndentityService.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 07:13:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108205#M75856</guid>
      <dc:creator>tbee</dc:creator>
      <dc:date>2012-09-06T07:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: identity in a webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108206#M75857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;First your runtime enviromnment "knows" the authenticated user i.e. request.getPrincipal(). Then you "tell" it to Activiti Engine with identityService.setAuthenticatedUserId( userId ). Then when you do some operations like start a new process instance or add a comment then the engine "knows" the authenticated user for a while you do the operation. Normally I immediately identityService.setAuthenticatedUserId(null); after the operation. The claim for me is the method where you set the user explicity. Why then need to get the user from identityService? Grab it from request if in servlet environment. Hope that helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2012 15:21:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108206#M75857</guid>
      <dc:creator>p4w3l</dc:creator>
      <dc:date>2012-09-11T15:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: identity in a webapp</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108207#M75858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I fully agree, hence I would expect a method "claim()" which claims a task in name of the authenticated user. But that call does not exist, you need to specify a username.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2012 16:03:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/identity-in-a-webapp/m-p/108207#M75858</guid>
      <dc:creator>tbee</dc:creator>
      <dc:date>2012-09-11T16:03:27Z</dc:date>
    </item>
  </channel>
</rss>

