How to add a custom header in outgoing notifications with Orion?

前端 未结 1 623
遥遥无期
遥遥无期 2021-01-16 06:39

I read the \"Custom notifications\" section in the NGSIv2 specification and I still have doubts in how to make this work.

Do I have to put in my subscribe POST the

相关标签:
1条回答
  • 2021-01-16 07:18

    The following httpCustom could be used:

    "httpCustom": {
      "url": "http://example.com/some/path",
      "headers": {
        "X-Auth-Token": "n5u43SunZCGX0AbnD9e8R537eDslLM"
      }
    }
    

    The token will expire from time to time. Thus, it should be renewed at a regular interval, modifying the httpCustom element with the new token (using PATCH /v2/subscriptions/<id> operation, see NGSIv2 specification for details).

    Regarding Rush, it is not necesary if you can achieve the HTTP-to-HTTPS with some equivalent software. Native HTTPS notifications at Orion has been identified as a topic of interest and even there was a pull request with code implementation in that line. Currently it isn't a priority, however contributions related with this are welcomed :)

    EDIT: the above httpCustom configuration will make Orion sending notifications including that X-Auth-Token header. Thus, it is supposed that at the url endpoint (e.g. http://example.com/some/path in the example above) the authentication elements able to process the X-Auth-Token header will be listening (typically, a Policy Enforcement Point -PEP- Proxy).

    UPDATE: since verion 1.7.0, Orion implements native HTTPS notifications (i.e. without needing Rush).

    0 讨论(0)
提交回复
热议问题