1
0
-1

Hello team.

We are developing an integration with Aruba ClearPass through the API. We were already able, successfully, to receive a token through identification with username and password through a JSON type plugin, as I show in the image below.



With that token, we should be able to make transactions, as seen in these CURL commands:

curl -X POST "https://<ClearPass IP/hostname>/api/guest" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer a6d2873200bee25768307c32ee22415ac8ad203a" \
     --data '{
  "enabled": true,
  "expire_time": "1438562410",
  "password": "Aruba@!23$",
  "role_id": 2,
  "username": "testaccount"
                }'\
            -m 30 \
            -v \
            -k


However, we do not know how to include additional header elements in the configuration of the joget plugin (-h in the code), since they are not part of the JSON Body and the server needs these parameters and otherwise it returns errors of unauthorized type (403).

Anyone with experience in this subject or ideas about it?

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi, in the JSON Tool configuration there are options for Request Headers. You should be able to include your header elements there.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi. We have followed the indication, however it has not worked for us and the LOG does not give us more information about it:

        INFO  06 sept. 2019 09:42:01 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=4_sanolivarExperience_notificacionIndividual, processDefId=sanolivarExperience#1#notificacionIndividual, participantId=participant3, next user=[admin]]
        INFO  06 sept. 2019 09:42:01 org.joget.apps.app.lib.UserNotificationAuditTrail  - Users to notify: [admin]
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - POST : http://192.168.1.80/api/guest
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding param enabled : true
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding param expire_time : 1438562410
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding param password : Aruba@!23$
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding param role_id : 2
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding param username : testaccount
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding request header Content-Type : application/json
        INFO  06 sept. 2019 09:43:04 org.joget.apps.app.lib.JsonTool  - Adding request header Authorization : Bearer 04d17810e2dcd84aef298ba96fff9fcb4a70866e
        INFO  06 sept. 2019 09:43:05 org.joget.apps.app.lib.JsonTool  - http://192.168.1.80/api/guest returned with status : 400
        INFO  06 sept. 2019 09:43:05 org.joget.apps.app.lib.JsonTool  - {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Bad Request","status":400,"detail":"JSON decoding error: Syntax error, malformed JSON"}

        Syntax error, malformed JSON.  Is there a way to make this same call through, perhaps, beanshell or similar? As I mentioned, through CURL it works fine.

        1. Anders

          The response error is 400 Bad Request, and the detail says "JSON decoding error: Syntax error, malformed JSON" so it is missing some JSON in the body like in the CURL example. You can try to use Custom JSON Payload instead of POST parameters.

        CommentAdd your comment...