<?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 authenticatedUserId no set in REST 5.16.4  in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/authenticateduserid-no-set-in-rest-5-16-4/m-p/199109#M152239</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using configuration in activiti-webapp-rest2, authenticatedUserId is only passed to Activiti on first REST call only. Due to spring security settings which saves authentication in session, BasicAuthenticationProvider.authenticate() gets called only once per session, resulting in not passing authenticatedUserId to Activiti.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To fix this sessionManagement and securityContext needs to be disabled by modifying SecurityConfiguration.configure() as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .authenticationProvider(authenticationProvider())&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .csrf().disable()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .sessionManagement().disable()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .securityContext().disable()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .authorizeRequests()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .anyRequest().authenticated()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .and()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .httpBasic();&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Oct 2014 00:33:01 GMT</pubDate>
    <dc:creator>balsarori</dc:creator>
    <dc:date>2014-10-26T00:33:01Z</dc:date>
    <item>
      <title>authenticatedUserId no set in REST 5.16.4</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/authenticateduserid-no-set-in-rest-5-16-4/m-p/199109#M152239</link>
      <description>Using configuration in activiti-webapp-rest2, authenticatedUserId is only passed to Activiti on first REST call only. Due to spring security settings which saves authentication in session, BasicAuthenticationProvider.authenticate() gets called only once per session, resulting in not passing authenti</description>
      <pubDate>Sun, 26 Oct 2014 00:33:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/authenticateduserid-no-set-in-rest-5-16-4/m-p/199109#M152239</guid>
      <dc:creator>balsarori</dc:creator>
      <dc:date>2014-10-26T00:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: authenticatedUserId no set in REST 5.16.4</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/authenticateduserid-no-set-in-rest-5-16-4/m-p/199110#M152240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow - very good catch!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We eventually went with&amp;nbsp; .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) instead of disable().&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This also allows to keep the securityContext() enabled, which might come in handy one day.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's fixed here: &lt;/SPAN&gt;&lt;A href="https://github.com/Activiti/Activiti/commit/3bb10cf9e44f531d70d09b05fc6916acf3e4b2a2" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/commit/3bb10cf9e44f531d70d09b05fc6916acf3e4b2a2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a bug commit, cause we wanted to make sure we catch this error in test, so we refactored from using a new HttpClient instance for each call to using a shared one for all tests (which indeed highlighted your issue and didn't show it before).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This post is exactly one of the reasons why I keep visiting the forum every day. Really nice catch. Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Oct 2014 18:25:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/authenticateduserid-no-set-in-rest-5-16-4/m-p/199110#M152240</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2014-10-27T18:25:28Z</dc:date>
    </item>
  </channel>
</rss>

