2 Replies Latest reply on Dec 15, 2015 1:15 AM by sandeep gollapudi

    Need help in claiming the task

    sandeep gollapudi Newbie

      Hi All,


      Hope you are doing good.


      Am using jbmp6.2 remote api and Tomcat7. I was removed basic authentication.


      My requirement is from external system i have to trigger all the jbpm human task operations.


      Am able to start the process with out any issues after removing the basic authentication using the following url : http://localhost:8080/jbpm-console/rest/runtime/{deploymentId}/process/{processDefId}/start


      But when am trying to claim the task or completing the task am getting following error:


      For to Start a task: http://localhost:8080/jbpm-console/rest/task/1487/start


      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>




          <message>PermissionDeniedException thrown with message 'User '[UserImpl:'unknown']' does not have permissions to execute operation 'Start' on task id 1487'</message>

          <stackTrace>org.kie.remote.services.rest.exception.KieRemoteRestOperationException: User '[UserImpl:'unknown']' does not have permissions to execute operation 'Start' on task id 1487



      I understood that it use the user (id) used in the REST basic authorization as input for the user parameter in the specific call . But i have removed the basic authentication since external system only provides username in the url. Apart from the username i don't have any other info.


      Please suggest me is there any good approach i can follow to use the Remote API if it triggers from any external system.




      Thanks In Advance,

      Sandeep Gollapudi

        • 1. Re: Need help in claiming the task
          Abhijit Humbe Master



          You are facing this issue because you have disabled authentication for /rest end point. If you check source code you will see the action performed through REST API are done with the user that authenticated the REST call



              @Path("/{taskId: [0-9-]+}/{oper: [a-zA-Z]+}")

              public Response taskId_oper(@PathParam("taskId") long taskId, @PathParam("oper") String operation) {

                  Map<String, List<String>> params = getRequestParams(uriInfo);

                  operation = checkThatOperationExists(operation, allowedOperations);   

                  String userId = identityProvider.getName();

                  logger.debug("Executing " + operation + " on task " + taskId + " by user " + userId );


          To work with REST API you have to enable authentication of /rest endpoint. If you use RemoteREST API it can solve your issue, here we can use different user for authentication and another for task operation, like as:



          RuntimeEngine engine = RemoteRuntimeEngineFactory.newRestBuilder().addUrl(url).addUserName(userName).addPassword(passWord)


          TaskService taskService = engine.getTaskService();

          taskService.start(1, "abhi");

          taskService.complete(1, "abhi", null);


          Hope it helps..

          • 2. Re: Need help in claiming the task
            sandeep gollapudi Newbie

            Very useful. Thanks you soo much Abhijit Humbe .


            Sandeep Gollapudi