<?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 [RESOLVED] Spring authentication issue in 5.11 in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121602#M85674</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an application based on Spring Framework/Hibernate/Vaadin, split in differents layers (Repositories, Services, Views). I've secured my services methods with @PreAuthorize annotations.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use activiti engine to automate some treatments : I design workflows with Activiti Designer Eclipse Plug-In with java service tasks and I call my application services inside to do some treatments.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An other thing to know is that I start activiti processes in a thread authenticated as admin (to avoid rights problems with secured services methods). This is how I do it :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;public void run() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;super.run();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;securityUtility.authenticateAs(Constants.ADMIN_USER, Constants.ADMIN_PASSWORD);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RuntimeService runtimeService = processEngine.getRuntimeService();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;runtimeService.startProcessInstanceByKey(processId, variables);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my authenticateAs method :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;public Authentication authenticateAs(String username, String password) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ProviderManager providerManager = (ProviderManager)applicationContext.getBean("authenticationManager");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Authentication authentication = providerManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SecurityContextHolder.getContext().setAuthentication(authentication);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return authentication;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;It has always worked very well and did everything I wanted until I upgraded to 5.11.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I got some securities exceptions when the activiti service task try to call my secure service method :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;org.springframework.security.authentication.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The strange thing is that some service tasks are working and some others not (for example the first one and the second are working but not the third). It looks like I lost the authentication during the workflow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does someone know a change related to that in 5.11?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jan 2013 17:34:01 GMT</pubDate>
    <dc:creator>aduarte</dc:creator>
    <dc:date>2013-01-24T17:34:01Z</dc:date>
    <item>
      <title>[RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121602#M85674</link>
      <description>Hi everybody,I have an application based on Spring Framework/Hibernate/Vaadin, split in differents layers (Repositories, Services, Views). I've secured my services methods with @PreAuthorize annotations.I use activiti engine to automate some treatments : I design workflows with Activiti Designer Ecl</description>
      <pubDate>Thu, 24 Jan 2013 17:34:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121602#M85674</guid>
      <dc:creator>aduarte</dc:creator>
      <dc:date>2013-01-24T17:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121603#M85675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is not related to the thread because if I start the process directly from my app, I still got the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for helping&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 17:43:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121603#M85675</guid>
      <dc:creator>aduarte</dc:creator>
      <dc:date>2013-01-24T17:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121604#M85676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are the service-tasks asynchronous? From what I remember, the security-context is stored thread-local. So as long as the same thread is used (and context is not cleared), this should be working all the time, or am I missing something?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 09:22:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121604#M85676</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2013-01-25T09:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121605#M85677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My service tasks are not asynchronous. I want to execute them in sequence. When a task is finished, the next starts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I read some thing about thread-local security context and I tried to fix my issue by setting the context in INHERITABLETHREADLOCAL strategy mode but nothing changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some news about my investigations:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I came back to activiti 5.10 in my pom.xml, and replace my workflow by an old version =&amp;gt; everything is ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I open the workflow with the designer (5.11) and just move the startevent 1 pixel to the left =&amp;gt; the problem came back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I compared the two files opening them in xml format and I see some changes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;isExecutable="true" has been added by the designer and "manualTask" has been replaced by "task"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 09:51:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121605#M85677</guid>
      <dc:creator>aduarte</dc:creator>
      <dc:date>2013-01-25T09:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121606#M85678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That could explain a lot… a manual-task will behave differently than a regular task? Is there a reason why you're using manual-tasks instead of user task or service task?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 10:32:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121606#M85678</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2013-01-25T10:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121607#M85679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I put a manualTask at the begin of all my processes in order to persist the process in the database because I read that when you start a process it is not persisted until a manualTask/userTask… and endEvent I imagine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But calls to my application services are done in service tasks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the beginning of my process to explain that : &lt;/SPAN&gt;&lt;A href="http://hpics.li/c3a7c34" rel="nofollow noopener noreferrer"&gt;http://hpics.li/c3a7c34&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 10:45:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121607#M85679</guid>
      <dc:creator>aduarte</dc:creator>
      <dc:date>2013-01-25T10:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121608#M85680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;CODE&gt;&lt;BR /&gt;/**&lt;BR /&gt; * Implementation of the BPMN 2.0 'manual task': a task that is external to the&lt;BR /&gt; * BPMS and to which there is no reference to IT systems whatsoever.&lt;BR /&gt; * &lt;BR /&gt; * Given this definition, this activity will behave simply as a pass-though step&lt;BR /&gt; * in the process.&lt;BR /&gt; * &lt;BR /&gt; * @author Joram Barrez&lt;BR /&gt; */&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Only wait-states will persist the process, the manual-task will just passthrough, not persisting… Not really sure why you want your process persisted, while it still could be rolled-back by an error in the subsequent service-tasks??&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 10:49:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121608#M85680</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2013-01-25T10:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: [RESOLVED] Spring authentication issue in 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121609#M85681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, I think I misread something. Removing the manual task at the beginning fixes my issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to make some tests because I think I have put that manual task to fix a problem about getting some process variables in some specific case (it has been a long time and don't remember exactly the problem I was facing but someone told me to put the manual task as a trick).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot for your help. I test if everything is ok and put the topic as resolved.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 11:25:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/resolved-spring-authentication-issue-in-5-11/m-p/121609#M85681</guid>
      <dc:creator>aduarte</dc:creator>
      <dc:date>2013-01-25T11:25:36Z</dc:date>
    </item>
  </channel>
</rss>

