restauthenticationspring-securityalfrescoalfresco-webscripts

WebScript require authentication with guest level


When there is a call to the WebScript from the Share, always appears the authentication dialog. Call to the web script performs from the workflow form.

Part of userdetails.ftl:

<#include "/org/alfresco/components/form/controls/common/utils.inc.ftl" />
...
<script>

Alfresco.util.Ajax.jsonGet(
   {
      url: "http://...:8080/alfresco/s/ms-ws/assignments?taskId=" + clearTaskId,
      successCallback:
      {
         fn: function(response)
         {
             if(response.json)
             {
                var json = JSON.parse(response.serverResponse.responseText);
                ...

                for(var i = 0; i < entries.length; i++) {
                    ...
                    var cell1 = row.insertCell(0);
                    var cell2 = row.insertCell(1);
                    var cell3 = row.insertCell(2);
                    var cell4 = row.insertCell(3);
                    var cell5 = row.insertCell(4);

                    cell1.innerHTML = entries[i].entry.jobtitle;
                    cell2.innerHTML = entries[i].entry.firstName;
                    cell3.innerHTML = "";
                    cell4.innerHTML = "";
                    cell5.innerHTML = "";
                }
             }
         },
         scope: this
       },

      failureCallback:
      {
         fn: function(response)
         {
            alert("error!");
         },
         scope: this
      }
});

</script>

My assignments.get.xml:

<webscript>
    <shortname>Get all assignments for the specific process instance</shortname>
    <description>Returns a list of assignments for the specific process instance</description>
    <url>/ms-ws/assignments?id={taskId}</url>
    <url>/ms-ws/assignments.json?id={taskId}</url>
    <url>/ms-ws/assignments.html?id={taskId}</url>
    <format default="json">extension</format>
    <authentication>user</authentication>
    <transaction>none</transaction>
</webscript>

I tried to change user to guest and add &guest=true to the end of the web script URL, but it did not help.

How to disabling the authentication dialog in this case?


Solution

  • Instead of calling the repo tier from JavaScript running on the client it is often better to leverage the Share proxy, like /share/proxy/alfresco/ms-ws/assignments.

    If you access the repo tier directly from the client side, you are making some assumptions about the network and the Alfresco deployment that may not always be true (i.e., ability to hit the Alfresco repo tier directly).