<?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 Re: Authorization header - Activiti REST in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32808#M13882</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so you have run across the downside of not requiring authorization.&lt;/P&gt;&lt;P&gt;The createProcessInstance method (used to start an instance) takes the "initiator" from the Activiti Authentication provider.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; String authenticatedUserId = &lt;STRONG&gt;Authentication.getAuthenticatedUserId()&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;String initiatorVariableName = (String) getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;if (initiatorVariableName!=null) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;processInstance.setVariable(initiatorVariableName, authenticatedUserId);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;if (authenticatedUserId != null) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;processInstance.addIdentityLink(authenticatedUserId, null, IdentityLinkType.STARTER);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if you dont have any authentication you will need another way of setting the current user. Perhaps a header.&lt;/P&gt;&lt;P&gt;Then, you will need to add &amp;nbsp;your own custom Authentication and userdetails service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, you cant have it both ways.&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 May 2017 16:13:10 GMT</pubDate>
    <dc:creator>gdharley</dc:creator>
    <dc:date>2017-05-15T16:13:10Z</dc:date>
    <item>
      <title>Authorization header - Activiti REST</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32805#M13879</link>
      <description>Hi Team,I have a query regarding Authorization header set for every Activiti-rest API call.As per the user guide, this header is mandatory for rest calls or we can pass uname&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;ass along with the url.Is there any way we can skip this and directly make the rest call by hitting the url without Authoriz</description>
      <pubDate>Thu, 11 May 2017 17:06:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32805#M13879</guid>
      <dc:creator>sonalik</dc:creator>
      <dc:date>2017-05-11T17:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Authorization header - Activiti REST</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32806#M13880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can easily disable the need for authorization by updating the Spring Security configuration.&lt;/P&gt;&lt;P&gt;If you are using Community Edition (e.g. 5.22.0) this is simply a matter of opening the following file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;activiti-webapp-rest2/src/main/java/org/activiti/rest/conf/SecurityConfiguration.java&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now change the following :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #808000;"&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;protected void &lt;/SPAN&gt;configure(HttpSecurity http) &lt;SPAN style="color: #000080; font-weight: bold;"&gt;throws &lt;/SPAN&gt;Exception {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .authenticationProvider(authenticationProvider())&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;STATELESS&lt;/SPAN&gt;).and()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .csrf().disable()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .authorizeRequests()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .anyRequest().authenticated()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .and()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .httpBasic();&lt;BR /&gt;}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #808000;"&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;protected void &lt;/SPAN&gt;configure(HttpSecurity http) &lt;SPAN style="color: #000080; font-weight: bold;"&gt;throws &lt;/SPAN&gt;Exception {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; http&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .authenticationProvider(authenticationProvider())&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;STATELESS&lt;/SPAN&gt;).and()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .csrf().disable()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .authorizeRequests().anyRequest().permitAll();&lt;BR /&gt;}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If you are using Enterprise Edition, you will need to build your own activiti-app war using the embedded-example available in the product download page. Once you have your custom app, you can customize the security configuration the same way as above.&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 May 2017 19:25:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32806#M13880</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-05-11T19:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Authorization header - Activiti REST</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32807#M13881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the solution. It worked for me. But at the same time i am facing another issue related to "initiator".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a process definition, where for start event i have set initiator. So when the Authorization header was set the initiator was automatically assigned to the user mentioned in header.&lt;/P&gt;&lt;P&gt;For example below is the sample json POST request to start a process:-&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;STRONG&gt;Authorization:kermit/kermit&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; "processDefinitionKey":"sample-process",&lt;BR /&gt; "businessKey":"sample123"&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Here the initiator=kermit (automatically set)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now when the header is not set, i am not able to set the initiator (or not able to start process using user)&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;{&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;"processDefinitionKey":"sample-process",&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;"businessKey":"sample123"&lt;/SPAN&gt;&lt;BR style="background-color: #f6f6f6;" /&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried setting "initiator" in the 2nd json call but the process started with blank START_USER_ID_ (DB column in act_hi_procinst table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help which additional attribute is required in the JSON call in order to set the starter/initiator for a process instance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking forward for your support as always.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sonali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 10:52:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32807#M13881</guid>
      <dc:creator>sonalik</dc:creator>
      <dc:date>2017-05-15T10:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Authorization header - Activiti REST</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32808#M13882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so you have run across the downside of not requiring authorization.&lt;/P&gt;&lt;P&gt;The createProcessInstance method (used to start an instance) takes the "initiator" from the Activiti Authentication provider.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; String authenticatedUserId = &lt;STRONG&gt;Authentication.getAuthenticatedUserId()&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;String initiatorVariableName = (String) getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;if (initiatorVariableName!=null) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;processInstance.setVariable(initiatorVariableName, authenticatedUserId);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;if (authenticatedUserId != null) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;processInstance.addIdentityLink(authenticatedUserId, null, IdentityLinkType.STARTER);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, if you dont have any authentication you will need another way of setting the current user. Perhaps a header.&lt;/P&gt;&lt;P&gt;Then, you will need to add &amp;nbsp;your own custom Authentication and userdetails service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, you cant have it both ways.&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 May 2017 16:13:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/authorization-header-activiti-rest/m-p/32808#M13882</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-05-15T16:13:10Z</dc:date>
    </item>
  </channel>
</rss>

